
ReactiveUI is a composable, cross-platform model-view-viewmodel framework for all .NET
platforms that is inspired by functional reactive programming, which is a paradigm that allows you
to abstract mutable state away from your user interfaces and express the idea around a feature in one readable place
and improve the testability of your application.
🔨 Get Started 🛍 Install Packages 🎞 Watch Videos 🎓 View Samples 🎤 Discuss ReactiveUI
A view shows data that changes, so it needs to know when a value changes. Written by hand, each property needs a
field and a setter that raises a change notification. Each command needs a property that wraps a method. ReactiveUI
writes that code for you while your project builds.
A source generator is a compiler add-on that writes C# code during the build. The ReactiveUI packages bring two
of them.
ReactiveUI.SourceGenerators writes reactive properties
and commands. ReactiveUI.Binding writes the code behind
WhenAnyValue, ToProperty and the view bindings. You install neither yourself.
1. Install the ReactiveUI package for your UI framework. A class library that holds only view models installs
ReactiveUI.
dotnet add package ReactiveUI.WPF
2. Declare the view model as a partial class and mark its members.
using ReactiveUI;
using ReactiveUI.SourceGenerators;
public partial class LoginViewModel : ReactiveObject
{
private readonly IObservable<bool> _canLogIn;
public LoginViewModel()
{
_canLogIn = this.WhenAnyValue(
static x => x.UserName,
static x => x.Password,
static (userName, password) => userName.Length > 0 && password.Length > 0);
_isValidHelper = _canLogIn.ToProperty(this, static x => x.IsValid);
}
[Reactive]
public partial string UserName { get; set; } = string.Empty;
[Reactive]
public partial string Password { get; set; } = string.Empty;
[ObservableAsProperty]
public partial bool IsValid { get; }
[ReactiveCommand(CanExecute = nameof(_canLogIn))]
private async Task<bool> LogInAsync(CancellationToken cancellationToken)
{
await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken);
return Password == "secret";
}
}
WhenAnyValue returns a stream, an IObservable<T> that emits a new value each time either property changes.
3. Build. The generators write the rest of the class:
- The bodies of
UserName and Password. Setting either one raises the change notification.
- The body of
IsValid and its _isValidHelper field. ToProperty keeps IsValid equal to the latest value of
_canLogIn.
- A
LogInCommand property. It holds a command, an ICommand that also reports each result as a stream. The
command runs LogInAsync, and it is enabled only while _canLogIn emits true. The generator drops the Async
suffix from the name.
Next, bind the properties and the command to your view with Bind and BindCommand. The
ReactiveUI.Binding documentation shows how. The
source generators documentation lists every attribute
and option.
Partial properties with an initial value need C# 14, the default language version for .NET 10.
How the packages fit together
ReactiveUI is a set of packages. You install the package for your UI framework, and it brings the rest.
| Package |
What it gives you |
ReactiveUI |
ReactiveObject, ReactiveCommand, activation, routing and schedulers, built on ReactiveUI.Primitives. It brings ReactiveUI.Core and ReactiveUI.Binding. |
ReactiveUI.Reactive |
The same API built for System.Reactive. It brings ReactiveUI.Core and ReactiveUI.Binding.Reactive. |
ReactiveUI.Core |
The parts both flavours share. It brings ReactiveUI.SourceGenerators. |
ReactiveUI.Binding |
WhenAnyValue, Bind, OneWayBind, BindCommand, ToProperty, [ObservableAsProperty] and view location. |
ReactiveUI.SourceGenerators |
[Reactive], [ReactiveCommand], [ReactiveCollection], [BindableDerivedList] and [IReactiveObject]. |
The ReactiveUI documentation covers the core package, and the
installation guide shows which
package to install for each platform.
ReactiveUI comes in two flavours with the same API. They differ only in the reactive types that appear in that API.
| You want |
Install |
Reactive types in the API |
| No System.Reactive dependency |
ReactiveUI, ReactiveUI.WPF, ReactiveUI.WinForms, ReactiveUI.WinUI, ReactiveUI.Maui, ReactiveUI.Blazor, ReactiveUI.AndroidX |
ReactiveUI.Primitives: RxVoid, ISequencer, Signal<T> |
| To mix with code that uses System.Reactive |
ReactiveUI.Reactive, ReactiveUI.WPF.Reactive, ReactiveUI.WinForms.Reactive, ReactiveUI.WinUI.Reactive, ReactiveUI.Maui.Reactive, ReactiveUI.Blazor.Reactive, ReactiveUI.AndroidX.Reactive |
System.Reactive: Unit, IScheduler, Subject<T> |
ReactiveUI.Primitives is ReactiveUI's own library of streams,
operators and schedulers. Both flavours run on it. The default flavour does not depend on System.Reactive, so your app
ships fewer assemblies.
The System.Reactive flavour puts its own types in the ReactiveUI.Reactive namespace. A file that uses
ReactiveObject or ReactiveCommand from it adds using ReactiveUI.Reactive;.
Bindings come from ReactiveUI.Binding
ReactiveUI runs WhenAnyValue, Bind, OneWayBind, BindCommand, ToProperty and view location on
ReactiveUI.Binding. Its source generator writes the code for each
binding while your project builds. Nothing looks up a property by name at run time, so bindings are safe to trim and
to publish with Native AOT.
The ReactiveUI package imports the ReactiveUI.Binding namespace into your project, so binding calls need no using.
Moving from an earlier version? The
migration guide covers
the calls that need an Unsafe twin and the behavior that changed.
Source generators come with ReactiveUI.Core
ReactiveUI.Core references
ReactiveUI.SourceGenerators and passes its generators
on. Every project that installs a ReactiveUI package can use [Reactive], [ReactiveCommand] and the other
attributes. Add using ReactiveUI.SourceGenerators; to each file that uses them. The generators check which flavour
your project references and write code for that flavour.
- Remove your own reference to ReactiveUI.SourceGenerators, or set it to the version ReactiveUI brings or later.
An older version fails to restore with error NU1605.
An analyzer checks your code as you type and reports problems as warnings or errors. ReactiveUI.Binding and
ReactiveUI.SourceGenerators run their analyzers in your project. They report binding calls and attributes that the
generators cannot handle. Diagnostic RXUIBIND021 flags a binding call with no generated binding behind it, such as
one that targets a member another source generator adds or a stored lambda; that call throws at run time, so treat
the warning as a bug to fix rather than suppress.
The analyzers inside ReactiveUI.Primitives stay out of your project. ReactiveUI references ReactiveUI.Primitives with
ExcludeAssets="analyzers". To use them, reference ReactiveUI.Primitives directly:
<PackageReference Include="ReactiveUI.Primitives" Version="x.y.z" />
Routing (RoutingState and IScreen) is part of the ReactiveUI package. The WPF, WinUI and MAUI packages add a
RoutedViewHost control that shows the current view, and Windows Forms adds RoutedControlHost. RoutingState reports
navigation as streams. CurrentViewModel emits the view model on top of the stack. NavigationStackChanged emits a
read-only copy of the whole stack after each change. CanNavigateBack emits whether there is a view model to go back
to. The routing migration guide
covers moving from the ReactiveUI.Routing package.
Install the package for your UI framework. Each one brings ReactiveUI. Each one except ReactiveUI.Uno has a
.Reactive twin for the System.Reactive flavour.
ReactiveUI.Avalonia and ReactiveUI.Uno live in their own repositories.
ReactiveUI.Validation adds validation rules for view models. It lives in its own repository.

- RxSchedulers - Using ReactiveUI schedulers without RequiresUnreferencedCode attributes
There has been an excellent book written by our Alumni maintainer
Kent Boogart.
JetBrains gives ReactiveUI's maintainers licences for its tools through its
open source support programme.
Anthropic supports them with Claude through
Claude for Open Source.
OpenAI supports them with Codex through
Codex for Open Source.

See our sponsors for more information.
JetBrains, Claude, Anthropic, OpenAI and Codex names and logos are trademarks of their respective owners.
The core team members, ReactiveUI contributors and contributors in the ecosystem do this open-source work in their free
time. If you use ReactiveUI, a serious task, and you'd like us to invest more time on it, please donate. This project
increases your income/productivity too. It makes development and applications faster and it reduces the required
bandwidth.
Become a sponsor.
Migration from Xamarin and .NET 8 MAUI
As of May 2024, Microsoft ended support for Xamarin per
their support policy. ReactiveUI has removed
support for legacy Xamarin platforms in favor of modern .NET MAUI. For Xamarin projects:
- Xamarin.Forms → Migrate to MAUI and use
ReactiveUI.Maui
- Xamarin.Android → Migrate to MAUI Android or use
ReactiveUI.AndroidX for native Android
- Xamarin.iOS/Mac → Migrate to MAUI iOS/Mac Catalyst
For guidance on migrating from Xamarin to MAUI, see
the official migration documentation.
ReactiveUI supports .NET 9 and .NET 10 for MAUI platforms:
net10.0-android / net9.0-android
net10.0-ios / net9.0-ios
net10.0-maccatalyst / net9.0-maccatalyst
net10.0-windows10.0.19041.0 / net9.0-windows10.0.19041.0
Non-MAUI net8.0 library targets remain fully supported.
Platform-specific sample applications are included in src/examples/:
All samples target .NET 10, use RxAppBuilder for initialization, and demonstrate WhenActivated, Bind/
BindCommand, and proper subscription disposal.
This is how we use the donations:
- Allow the core team to work on ReactiveUI
- Thank contributors if they invested a large amount of time in contributing
- Support projects in the ecosystem
If you have a question, please see if any discussions in
our GitHub issues
or Stack Overflow have already answered it.
If you want to discuss something or just need help, here is our Slack room, where there
are always individuals looking to help out!
Please do not open GitHub issues for support requests.
ReactiveUI is developed under an OSI-approved open source license, making it freely usable and distributable, even for
commercial use.
If you want to submit pull requests please first open
a GitHub issue to discuss. We are first time PR
contributors friendly.
See Contribution Guidelines for further information how to contribute changes.
The following have been core team members in the past.
ReactiveUI is part of the .NET Foundation. Other projects that are associated with
the foundation include the Microsoft .NET Compiler Platform ("Roslyn") as well as the Microsoft ASP.NET family of
projects, and Microsoft .NET Core.