System.Reactive.Windows.Forms
7.0.0-preview.20
Prefix Reserved
Requires NuGet 2.12 or higher.
dotnet add package System.Reactive.Windows.Forms --version 7.0.0-preview.20
NuGet\Install-Package System.Reactive.Windows.Forms -Version 7.0.0-preview.20
<PackageReference Include="System.Reactive.Windows.Forms" Version="7.0.0-preview.20" />
<PackageVersion Include="System.Reactive.Windows.Forms" Version="7.0.0-preview.20" />
<PackageReference Include="System.Reactive.Windows.Forms" />
paket add System.Reactive.Windows.Forms --version 7.0.0-preview.20
#r "nuget: System.Reactive.Windows.Forms, 7.0.0-preview.20"
#:package System.Reactive.Windows.Forms@7.0.0-preview.20
#addin nuget:?package=System.Reactive.Windows.Forms&version=7.0.0-preview.20&prerelease
#tool nuget:?package=System.Reactive.Windows.Forms&version=7.0.0-preview.20&prerelease
Windows Forms support for Rx (Reactive Extensions for .NET)
This is part of the Reactive Extensions for .NET (Rx). Rx enables event-driven programming with a composable, declarative model. The main Rx package is System.Reactive, which provides the core types and operators. This package, System.Reactive.Windows.Forms, provides additional support for using Rx with Windows Forms applications.
If you had been using the Windows Forms support in earlier versions of Rx (pre v7), you'll know that all UI-framework-specific functionality used to live in the main System.Reactive package. See ADR 0005 (Moving UI framework support out of System.Reactive) for an in depth explanation of the reason for moving these features out into separate packages.
Getting started
Run the following at a command line:
mkdir TryRxWinforms
cd TryRxWinforms
dotnet new winforms
dotnet add package System.Reactive.Windows.Forms
Alternatively, if you have Visual Studio installed, create a new .NET Windows Forms project, and then use the NuGet package manager to add a reference to System.Reactive.Windows.Forms.
You can then add the following code to your Form1.cs. First, add this using directive at the top of the file:
using System.Reactive.Linq;
Then inside the constructor, after the call to InitializeComponent() add this:
IObservable<long> ticks = Observable.Timer(
dueTime: TimeSpan.Zero,
period: TimeSpan.FromSeconds(1));
ticks
.ObserveOn(this)
.Subscribe(tick => this.Text = $"Tick {tick}");
This creates an observable source (ticks) that produces an event once every second. It adds a handler to that source that updates the main window's title bar text. By default, an Observable.Timer created in this way will raise events on a thread pool thread, which would result in an exception when trying to set the window title bar. This example avoids that problem by calling ObserveOn(this). This invokes an overload of ObserveOn that is specific to the System.Reactive.Windows.Forms library. It declares that we want a wrapper around the ticks observable that will raise notifications through the event loop for the Control passed to ObserveOn. So when the handler specified in Subscribe executes, it does so on the UI thread, meaning it is able to update the window title successfully.
Feedback
You can create issues at the https://github.com/dotnet/reactive repository
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. |
| .NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- System.Reactive (>= 7.0.0-preview.20)
- System.Threading.Tasks.Extensions (>= 4.6.3)
-
net8.0-windows7.0
- System.Reactive (>= 7.0.0-preview.20)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on System.Reactive.Windows.Forms:
| Package | Downloads |
|---|---|
|
System.Reactive.Compatibility
Reactive Extensions (Rx) Compatibility Library for enabling v3 apps to work with v4 |
|
|
CarCake.TabDocWinLib
Part of the CarCake Framework |
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on System.Reactive.Windows.Forms:
| Repository | Stars |
|---|---|
|
Wouterdek/NodeNetwork
A C# library with a WPF node editor component based on ReactiveUI
|
|
|
IllusionMods/KKManager
Mod, plugin and card manager for games by Illusion that use BepInEx
|
|
|
microsoft/Tx
Tx (LINQ to Events)
|
| Version | Downloads | Last Updated |
|---|---|---|
| 7.0.0-preview.20 | 38 | 6/3/2026 |
| 7.0.0-preview.16 | 61 | 5/26/2026 |
| 7.0.0-preview.15 | 64 | 5/20/2026 |
| 7.0.0-preview.1 | 525 | 11/6/2025 |
| 6.1.0 | 9,549 | 10/3/2025 |
| 6.1.0-preview.9 | 235 | 10/1/2025 |
| 6.0.2 | 2,956 | 8/29/2025 |
| 6.0.1 | 171,829 | 5/22/2024 |
| 6.0.1-preview.1 | 1,299 | 6/14/2023 |
| 6.0.0 | 38,835 | 5/19/2023 |
| 6.0.0-preview.16 | 375 | 5/17/2023 |
| 6.0.0-preview.13 | 465 | 4/20/2023 |
| 6.0.0-preview.9 | 460 | 3/31/2023 |
| 6.0.0-preview.1 | 452 | 3/10/2023 |
| 5.0.0 | 73,930 | 11/10/2020 |
| 5.0.0-preview.220 | 597 | 10/15/2020 |
| 5.0.0-preview.16 | 682 | 9/26/2020 |
| 4.4.1 | 740,922 | 4/2/2020 |
| 4.3.2 | 21,527 | 12/24/2019 |
| 4.2.2 | 1,446 | 12/24/2019 |