O'Reilly logo

Building Enterprise Applications with Windows® Presentation Foundation and the Model View ViewModel Pattern by Raffaele Garofalo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The View

In the MVVM pattern, the View is the graphical interface in charge of displaying data to users and interacting with them. If you’re writing a WPF application, the View might be a UserControl, a Window, or a Page; however, in a Silverlight application, the View will be a Silverlight User Control or a Silverlight Page or a Silverlight Child Window (a pop-up).

To make the View MVVM compatible, you first need to add a reference to the corresponding ViewModel in the DataContext of the View. This allows you to start to bind the properties and commands of the ViewModel to the corresponding controls exposed in the View. To do that, you just add a reference to the DataContext using a procedural approach, as in the following code:

/// <summary> /// ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required