-
Notifications
You must be signed in to change notification settings - Fork 0
BaseViewModel
Artem Kirgizov edited this page May 31, 2021
·
5 revisions
Namespace: Toolkit.Components.ViewModels
BaseViewModel - an abstract class that implements the INotifyPropertyChanged interface. It is primarily intended for inheritance by classes representing the ViewModel wrapper in WPF and UWP.
The main features of the class:
private string someProperty;
public string SomeProperty
{
get => someProperty;
set
{
someProperty = value;
OnPropertyChanged(); // no need to specify a method name like OnPropertyChanged(nameof(SomeProperty));
}
}
private string someProperty;
public string SomeProperty
{
get => someProperty;
set => SetProperty(ref someProperty, value); // the call to OnPropertyChanged () is encapsulated inside the method
}