An Introduction to the Model-View-ViewModel Pattern rakeshk@damcogroup.com rakesh308@gmail.com
WPF Intoduced in 3Framework 3.0. XAML UI Language. Vector Based rendering. Rich Composition ……………. TWO WAY DATABINDING
What is MVVM? Model View ViewModel
Standing on the Shoulders of Giants MVC MVP Martin Fowler Josh Smith John Gossman Sean Wildermuth
Why MVVM? Separation Of Concerns Test Driven Approach Code Cleanliness & Modular Approach Support WPF two way Data binding feature.
How Do We Achieve that? View ViewModel Model
DONOT FOLLOW THIS View View View ViewModel Model
A More Complete Diagram Unit Tests Integration Tests View XAML, Code Behind Bindings Behavior Actions ViewModel Properties, Commands, View Logic Data Events Model Service Proxies Web
DEMO – SAMPLE
MVVM Guidelines 1. Reduce or eliminate your code-behind 2. Bind all of your UI inputs/outputs to your ViewModel 3. Implement INotifyPropertyChanged on your ViewModel 4. When testing, treat ViewModel as the Real UI 5. Avoid events. Use commands instead
Third Party Support Prism MVVM Light Caliburn Silverlight FX