A .NET Standard class library with helpers to assist with bindings in an MVVM environment.
License
—
Deps
7
Install Size
—
Vulns
✓ 0
Published
Apr 29, 2024
$ dotnet add package BindingBitsThis library is available from NuGet.org.
A .NET Standard class library with helpers to assist with bindings in an MVVM environment.
See the changelog for changes and roadmap.
A base class implementing INotifyPropertyChanged, simplifying implementing this critical interface.
If a property in a class that inherits from ObservableObject has a private member setup as a backing field, the Set method can be used, passing in the backing field by reference. If the value has changed, PropertyChanged will be raised.
private bool _isCool;
public bool IsCool
{
get
{
return _isCool;
}
set
{
Set(ref _isCool, value);
}
}
The ObservableObject base class can also be used without setting up property backing fields. This just requires using the Get<T> method, and eliminates the need to pass in a variable by reference when calling Set.
public bool IsHot
{
get
{
return Get<bool>();
}
set
{
Set(value);
}
}