The ObservableObject
class contains some helpful methods to help with the MVVM pattern.
The RaisePropertyChanged
provides a compile safe method to raise property changed events.
It can be called with
RaisePropertyChanged(() => MyProperty);
The Set
method can be used in the property setter to set the new value and raise the property changed event (only if change occurred). It returns true
if change occurred and false
otherwise.
example usage:
private string _myValue;
public string MyValue
{
get { return _myValue; }
set { Set(ref _myValue, value); }
}