ViewModels

The ViewModel is an object introduced by the Model View ViewModel (MVVM) pattern, a specific presentation pattern designed for WPF and Silverlight (and right now used also in Windows Phone 7). The core of this pattern is the Model for View, i.e., the ViewModel. We will analyze this and other concepts in more detail in the chapter dedicated to UI patterns for WPF, but right now let’s just identify this object as the ViewModel and create one for each View of the TimeTracker application.

So, what is the main purpose of a ViewModel object and what should it implement? The ViewModel should implement the INotifyPropertyChanged interface so it can be bound dynamically to a View. It should also provide a mechanism for validation, and it should ...

Get Applied WPF 4 in Context now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.