Wading into MVVM
Thursday, December 22, 2011
- Commands rather than Events
- instead of event handlers, think in terms of firing commands that will find their way to the corresponding command properties declared on ViewModels
- i.e. use Command attribute of XAML widgets rather than Click event handler
- MVVM popularized class RelayCommand works well as a lightweight ICommand implementation to use on ViewModels
- or barring that, use the Expression Blend Interactivity DLL to map click events to Model object methods via "CallMethodAction" behavior