Class BindableBase
- Namespace
- DotNetQuery.Mvvm
- Assembly
- DotNetQuery.Mvvm.dll
A minimal INotifyPropertyChanged base class for view models.
Deliberately not named ObservableObject to avoid ambiguity with MVVM toolkits
that may coexist in consuming applications.
public abstract class BindableBase : INotifyPropertyChanged
- Inheritance
-
BindableBase
- Implements
- Derived
- Inherited Members
Methods
RaisePropertyChanged(string?)
Raises PropertyChanged for propertyName.
Call on the UI thread — bindings expect notifications there.
protected void RaisePropertyChanged(string? propertyName = null)
Parameters
propertyNamestringThe property name; defaults to the calling member.
SetProperty<T>(ref T, T, string?)
Sets field to value and raises PropertyChanged
when the value changed according to Default.
protected bool SetProperty<T>(ref T field, T value, string? propertyName = null)
Parameters
fieldTThe backing field.
valueTThe new value.
propertyNamestringThe property name; defaults to the calling member.
Returns
- bool
truewhen the value changed and a notification was raised.
Type Parameters
TThe property type.
Events
PropertyChanged
Occurs when a property value changes.
public event PropertyChangedEventHandler? PropertyChanged