Model-View-ViewModel (MVVM)#
MVVM is a popular software architecture pattern commonly used with WPF applications
- Model-View-ViewModel pattern
- 2 way binding
- The View
DataContext
property should be assigned an implementation of the View Model “{Binding …}”
XAML element links a View property to a View Model property
- The View
- Change notification
- View Model should implement the
INotifyPropertyChanged
interfacePropertyChanged
event should be raised whenever a property value changes
- View Model should implement the
- Commands
- View Model must provide an implementation of the
ICommand
interface per command
- View Model must provide an implementation of the
- 2 way binding
- Helper classes provided by the Display API to implement the above
BindableBase
base class- Implements
INotifyPropertyChanged
- Provides
SetProperty
methods to simplify following the pattern
- Implements
DisposableBindableBase
base class- As per
BindableBase
but also supportsIDisposable
- As per
DelegateCommand
class- Provides a generic implementation of
ICommand
for commands
- Provides a generic implementation of