Using Reactive UI in Your .NET MAUI App
ReactiveUI is one of Mark’s favourite MVVM libraries for C#, so he checks how well it works in a .NET MAUI app. He starts from a new project with the ReactiveUI .NET MAUI and ReactiveUI Fody packages, then moves the logic out of the view and into a ViewModel.
The key pieces:
- ViewModel setup: inherit from
ReactiveObjectand use the[Reactive]and[ObservableAsProperty]attributes from Fody to cut down on property boilerplate. - Commands and bindings: a
ReactiveCommandhandles the button click, and the counter value drives the button text. - Timer sample: an
Observable.TimerinsideWhenActivatedupdates a greeting every second and is disposed when the user navigates away. - Dependency injection: register the page and ViewModel in
MauiProgram.cs, then inject the ViewModel into aReactiveContentPage<T>.
It’s a practical starting point if you know MVVM and want to see how the reactive approach fits with the MAUI project template. The complete sample is on GitHub.