As people apply data binding to real applications, patterns have emerged. One of the most prevalent is Model-View-ViewModel. In truth, MVVM is not just one pattern. It is a collection if interrelated patterns. Each person has a different idea of what MVVM actually looks like. This is my opinion.
We will walk through the emergence of MVVM in a WPF application. The goal of this exercise is to understand why it is good to follow these patterns. We are going to start with direct data binding. We won’t add any code until we need it. When we find that things don’t work, we’ll add code to make them work. When things start to get messy, we will refactor to clean them up.
- Model and View
- Dependent properties (but not DependencyProperties)
- ItemsSource and SelectedItem
- The ViewModel layer
- Communicate through the data model
Slides and source code from the talk are at http://qedcode.com/mvvm.
- Dallas Day of .NET - 3/4/2011