Close this search box.

Deep Dive MVVM samples #mix11 #deepdivemvvm

Here is the sample code I demoed in my MIX11 session “Deep Dive MVVM”. Please download the Zip file, and then unblock it in Windows Explorer by right-clicking it, and then selecting Properties. If you see an “Unblock” button, please click it. You can then extract the content of the Zip file on your hard drive.

The slides are also available for download.

Last year’s session

To fully understand this session, an understanding of what MVVM is should be available. I recommend the following links:

This year’s session

The video of Deep Dive MVVM is already available for download (awesome job, MIX team). Go to the MIX website to download it in various formats, or stream it.


To execute the samples, you should have Visual Studio 2010 as well as the Windows Phone 7 tools installed.

Update: Getting the samples to run

In order to run the JsonDemo sample, you need to run the web application first because the Facebook service simulation is local. The easiest way is to right click on JsonDemo.SL4TestPage.html and select “View in Browser” from the context menu. This will start the development web server in Visual Studio. Then, you can run the WP7 application in the emulator.


For your convenience, I added the snippets of code that I was dragging/dropping from the Toolbox during the session. The file “snippets.txt” is included inside the ZIP file.

00 JsonDemo – Start

This is the start state, which will compile and run fine, but without the added functionality we built in during the session.

01 JsonDemo – After wiring up

This is the state of the application after the first demo, where all the objects are wired up and connected, and the message is sent from the MasterViewModel to the DetailsViewModel. We also added the IsOlderThanMeIndicatorVisibility property and connected it to the corresponding Rectangle in the DataTemplate (in the MasterView).

02 JsonDemo – Behaviors

This is the state after adding the “please wait” animation, the states and connecting the MasterViewModel’s IsBusy property to the GoToStateAction and ControlStoryboardAction instances through the DataTrigger. In Windows Phone 7, we added some code behind to replicate the functionality.

03 JsonDemo – WP7 DialogService

In this section we added a view service, the IDialogService, to the WP7 application and implemented it to display a custom message box. In SL4, the functionality is also available although no custom message box was made, so the fallback MessageBox is used instead.

04 NavigationDemo

This section introduces another view service, the INavigationService with one implementation in Silverlight 4 and one for Windows Phone 7.

05 JsonDemo – Unit test

In this last section, we add unit tests (with mock, well precisely with stubs!) to the Silverlight 4 and to the Windows Phone 7 applications. This is the final state of the demo.

I hope that this session was helpful, and that it will help you build awesome MVVM applications!

Happy coding,


GalaSoft Laurent Bugnion

Laurent Bugnion (GalaSoft)
Subscribe | Twitter | Facebook | Flickr | LinkedIn

Print | posted on Wednesday, April 13, 2011 3:04 PM

This article is part of the GWB Archives. Original Author: Laurent Bugnion (GalaSoft)

Related Posts