Skip to content

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
    • Change notification
      • View Model should implement the INotifyPropertyChanged interface
        • PropertyChanged event should be raised whenever a property value changes
    • Commands
      • View Model must provide an implementation of the ICommand interface per command
  • Helper classes provided by the Display API to implement the above
    • BindableBase base class
      • Implements INotifyPropertyChanged
      • Provides SetProperty methods to simplify following the pattern
    • DisposableBindableBase base class
      • As per BindableBase but also supports IDisposable
    • DelegateCommand class
      • Provides a generic implementation of ICommand for commands