Structure
With MVVM comes the concept of purity which refers to the amount of code in the code-behind. Here, we will be focusing on the pure approach—the style where no code is kept in the code-behind, and no references are kept between the view and view model.
Note
We will be covering varying degrees of purity, and the tradeoffs of each, in Chapter 4, Northwind—Services and Persistence Ignorance. However, if you are not interested in following the pure approach, you will still benefit from the material from this section, as it introduces the basic MVVM structure and sets up the design that will be used in our first example that will come later in this book.
Pure MVVM
Pure MVVM is structured as shown in the following diagram:
This structure is similar to MVP, except that there is no longer the IView
interface for communicating from presenter to view. All communications between view and view model are now handled using WPF's and Silverlight's binding systems.
In MVVM, the model takes on the...