The Model-View-ViewModel (MVVM) design pattern is a great way to separate the data from the user interface in your app. This sample demonstrates a simple MVVM application that uses XAML binding to connect the Views to the Model. The app in this sample is a “game tracker” in which the user can keep track of their achievements in a video game. This sample also uses a custom data converter, maintains page state when navigating to and from the app, and saves app data to isolated storage. For more info, see Implementing the Model-View-ViewModel Pattern in a Windows Phone Application.

To run this sample, you must have Windows Phone SDK 7.1 installed. To get started, go to the Windows Phone Dev Center.

To run the sample

  1. Double-click sdkMVVM.sln to open the solution.

  2. On the Build menu (or the Debug menu in Visual Studio 2010 Express for Windows Phone), click Build Solution. (Ctrl+Shift+B)

  3. On the Debug menu, click Start Debugging. (F5)

Note:

This sample is packaged as a Windows Phone 7.5 project. It can be converted to a Windows Phone 8 project, by changing the target Windows Phone OS version of the project. To create a Windows Phone 8 project, you must be running the Windows Phone SDK 8.0 on Visual Studio 2012. You can download the latest version of the SDK from http://dev.windowsphone.com/downloadsdk.

To convert the sample to a Windows Phone 8 project:

  1. Double-click the .sln file to open the solution in Visual Studio.

  2. Right-click the project in the Solution Explorer and select Properties. This opens the Project Properties window.

  3. In the Application tab of the Project Properties window, select Windows Phone OS 8.0 from the Target Windows Phone OS Version dropdown. A dialog will appear asking if you want to upgrade this project to Windows Phone OS 8.0.

  4. Select Yes to upgrade the project.