What is ReactiveUI?

September 26, 2026 Β· View on GitHub

Build Code Coverage #yourfirstpr



What is ReactiveUI?

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

Your first view model

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.

PackageWhat it gives you
ReactiveUIReactiveObject, ReactiveCommand, activation, routing and schedulers, built on ReactiveUI.Primitives. It brings ReactiveUI.Core and ReactiveUI.Binding.
ReactiveUI.ReactiveThe same API built for System.Reactive. It brings ReactiveUI.Core and ReactiveUI.Binding.Reactive.
ReactiveUI.CoreThe parts both flavours share. It brings ReactiveUI.SourceGenerators.
ReactiveUI.BindingWhenAnyValue, 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.

Pick a flavour

ReactiveUI comes in two flavours with the same API. They differ only in the reactive types that appear in that API.

You wantInstallReactive types in the API
No System.Reactive dependencyReactiveUI, ReactiveUI.WPF, ReactiveUI.WinForms, ReactiveUI.WinUI, ReactiveUI.Maui, ReactiveUI.Blazor, ReactiveUI.AndroidXReactiveUI.Primitives: RxVoid, ISequencer, Signal<T>
To mix with code that uses System.ReactiveReactiveUI.Reactive, ReactiveUI.WPF.Reactive, ReactiveUI.WinForms.Reactive, ReactiveUI.WinUI.Reactive, ReactiveUI.Maui.Reactive, ReactiveUI.Blazor.Reactive, ReactiveUI.AndroidX.ReactiveSystem.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.

Analyzers

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

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.

Platform packages

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.

PlatformPackageNuGet
Class librariesReactiveUICoreBadge
WPFReactiveUI.WPFWpfBadge
WinUIReactiveUI.WinUIWinUiBadge
MAUIReactiveUI.MauiMauiBadge
Windows FormsReactiveUI.WinFormsWinBadge
Android (AndroidX)ReactiveUI.AndroidXDroXBadge
BlazorReactiveUI.BlazorBlazBadge
AvaloniaReactiveUI.AvaloniaAvaBadge
Uno PlatformReactiveUI.UnoUnoBadge
Unit testsReactiveUI.TestingTestBadge

ReactiveUI.Avalonia and ReactiveUI.Uno live in their own repositories.

ReactiveUI.Validation adds validation rules for view models. It lives in its own repository. ValBadge

Documentation

  • RxSchedulers - Using ReactiveUI schedulers without RequiresUnreferencedCode attributes

Book

There has been an excellent book written by our Alumni maintainer Kent Boogart.

Sponsors

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.

JetBrains Claude by Anthropic OpenAI

See our sponsors for more information. JetBrains, Claude, Anthropic, OpenAI and Codex names and logos are trademarks of their respective owners.

Sponsorship

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

Xamarin Users

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.

MAUI Users

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.

Examples

Platform-specific sample applications are included in src/examples/:

SamplePlatformDescription
ReactiveUI.Samples.WpfWPFLogin form with reactive bindings, PasswordBox event marshaling
ReactiveUI.Samples.WinformsWinFormsLogin form with IViewFor, programmatic UI layout
ReactiveUI.Samples.MauiMAUICross-platform login with Shell navigation, ReactiveContentPage
ReactiveUI.Builder.WpfAppWPFMulti-instance chat app with routing, suspension, and network sync
ReactiveUI.Builder.BlazorServerBlazor ServerChat app with server-side Blazor and reactive components

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

Support

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.

Contribute

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.

Core Team


Glenn Watson

Melbourne, Australia


Chris Pulman

United Kingdom

Alumni Core Team

The following have been core team members in the past.


Geoffrey Huntley

Sydney, Australia


Kent Boogaart

Brisbane, Australia


Olly Levett

London, United Kingdom


AnaΓ―s Betts

San Francisco, USA


Brendan Forster

Melbourne, Australia


Claire Novotny

New York, USA


Artyom Gorchakov

Moscow, Russia


Rodney Littles II

Texas, USA


Colt Bauman

South Korea

.NET Foundation

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.