RoomSharp.Reactive.WinForms
0.5.5
dotnet add package RoomSharp.Reactive.WinForms --version 0.5.5
NuGet\Install-Package RoomSharp.Reactive.WinForms -Version 0.5.5
<PackageReference Include="RoomSharp.Reactive.WinForms" Version="0.5.5" />
<PackageVersion Include="RoomSharp.Reactive.WinForms" Version="0.5.5" />
<PackageReference Include="RoomSharp.Reactive.WinForms" />
paket add RoomSharp.Reactive.WinForms --version 0.5.5
#r "nuget: RoomSharp.Reactive.WinForms, 0.5.5"
#:package RoomSharp.Reactive.WinForms@0.5.5
#addin nuget:?package=RoomSharp.Reactive.WinForms&version=0.5.5
#tool nuget:?package=RoomSharp.Reactive.WinForms&version=0.5.5
RoomSharp.Reactive.WinForms
WinForms bindings for RoomSharp.Reactive observable queries.
Installation
dotnet add package RoomSharp.Reactive.WinForms
Bind to BindingList
using RoomSharp.Reactive;
using RoomSharp.Reactive.WinForms;
var list = new BindingList<Todo>();
using var sub = query
.AsObservable()
.BindToBindingList(
list,
keySelector: t => t.Id,
mergeExisting: (existing, incoming) =>
{
existing.Title = incoming.Title;
existing.IsDone = incoming.IsDone;
},
onError: error => Log(error));
For larger lists or more explicit behavior, pass WinFormsBindingOptions<T>:
using RoomSharp.Reactive;
using RoomSharp.Reactive.WinForms;
var list = new BindingList<Todo>();
using var sub = query
.AsObservable()
.BindToBindingList(
list,
new WinFormsBindingOptions<Todo>
{
KeySelector = todo => todo.Id,
UpdateMode = ReactiveCollectionUpdateMode.MergeByKey,
MergeExisting = (existing, incoming) =>
{
existing.Title = incoming.Title;
existing.IsDone = incoming.IsDone;
},
OnError = error => Log(error)
});
Bind to BindingSource (with UI dispatch)
using RoomSharp.Reactive;
using RoomSharp.Reactive.WinForms;
var source = new BindingSource();
using var sub = query
.AsObservable()
.BindToBindingSource(
source,
this, // Control for UI dispatch
keySelector: t => t.Id,
onError: error => Log(error));
The BindingSource overload can suspend binding during updates and preserve sort/filter strings:
using var sub = query
.AsObservable()
.BindToBindingSource(
source,
this,
new WinFormsBindingOptions<Todo>
{
KeySelector = todo => todo.Id,
SuspendBindingDuringUpdate = true,
PreserveSort = true,
PreserveFilter = true,
OnError = error => Log(error)
});
Bind to DataGridView (optional helper)
using RoomSharp.Reactive;
using RoomSharp.Reactive.WinForms;
using var sub = query
.AsObservable()
.BindToDataGridView(
dataGridView1,
keySelector: t => t.Id,
onError: error => Log(error));
Control-based overloads dispatch safely to the UI thread and dispose the subscription when the control is disposed. Binding updates report source and merge/update failures through onError instead of silently swallowing them.
BindToDataGridView preserves the current row and first displayed row by default. Disable either behavior when the grid owns navigation explicitly:
using var sub = query
.AsObservable()
.BindToDataGridView(
dataGridView1,
new WinFormsBindingOptions<Todo>
{
KeySelector = todo => todo.Id,
PreserveCurrentRow = true,
PreserveScrollPosition = true,
AutoDisposeWithControl = true,
OnError = error => Log(error)
});
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net9.0-windows7.0 is compatible. net10.0-windows was computed. net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- RoomSharp.Reactive (>= 0.5.5)
-
net8.0-windows7.0
- RoomSharp.Reactive (>= 0.5.5)
-
net9.0-windows7.0
- RoomSharp.Reactive (>= 0.5.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.