Majorsilence.Forms.Mvvm 26.11.20

dotnet add package Majorsilence.Forms.Mvvm --version 26.11.20
                    
NuGet\Install-Package Majorsilence.Forms.Mvvm -Version 26.11.20
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Majorsilence.Forms.Mvvm" Version="26.11.20" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Majorsilence.Forms.Mvvm" Version="26.11.20" />
                    
Directory.Packages.props
<PackageReference Include="Majorsilence.Forms.Mvvm" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Majorsilence.Forms.Mvvm --version 26.11.20
                    
#r "nuget: Majorsilence.Forms.Mvvm, 26.11.20"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Majorsilence.Forms.Mvvm@26.11.20
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Majorsilence.Forms.Mvvm&version=26.11.20
                    
Install as a Cake Addin
#tool nuget:?package=Majorsilence.Forms.Mvvm&version=26.11.20
                    
Install as a Cake Tool

Majorsilence.Forms.Mvvm

Wiring between a view model and Majorsilence.Forms controls, without reflection, so it survives trimming and NativeAOT with nothing rooted. It needs only INotifyPropertyChanged and ICommand: any view model works, including one written with CommunityToolkit.Mvvm, and this package does not depend on the toolkit.

using Majorsilence.Forms.Mvvm;

var scope = new BindingScope ();

// Pushes the current value now, and again on every change of that property, on the UI thread.
viewModel.Observe (nameof (CounterViewModel.Count), vm => vm.Count, count => label.Text = $"Count: {count}").AddTo (scope);

// Enabled follows CanExecute; a click runs the command.
incrementButton.BindCommand (viewModel.IncrementCommand).AddTo (scope);

// When the page is left:
scope.Dispose ();
  • Observe takes the property name (nameof) and a lambda that reads it, so nothing is looked up by string at run time.
  • BindText, BindChecked, BindSelectedIndex and BindValue keep a TextBox, CheckBox, ComboBox or NumericUpDown equal to a view model property in both directions, with a guard so the two updates cannot trigger each other.
  • BindCommand works on any Control, including custom-painted ones, and on menu and tool strip items. A Button or a ToolStripItem can also take a command through its own Command property; use one or the other on a control.
  • BindingScope disposes every binding it collected, latest first.
  • IUiDispatcher marshals to the UI thread. The default runs through the platform backend; pass your own in tests.

See docs/mvvm.md in the repository for threading, async commands and what is not covered.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
26.11.20 59 12/1/2026
26.11.19 113 11/24/2026
26.11.18 104 11/18/2026
26.11.16 107 11/17/2026
26.11.15 102 11/9/2026
26.11.14 99 11/6/2026
26.11.12 101 11/4/2026
26.11.11 115 10/30/2026
26.11.10 112 10/28/2026
26.11.9 115 10/22/2026
26.11.8 115 10/20/2026
26.11.7 121 10/18/2026
26.11.6 107 10/17/2026
26.11.5 140 10/14/2026
26.11.4 109 10/12/2026
26.11.3 116 10/11/2026
26.11.2 120 10/11/2026
26.11.1 128 10/10/2026
26.10.1 139 10/10/2026
26.10.0 136 10/10/2026
Loading failed