Over a million developers have joined DZone.

An Early Look at Silverlight Model-View-ViewModel Toolkit 1

DZone 's Guide to

An Early Look at Silverlight Model-View-ViewModel Toolkit 1

· ·
Free Resource


This post is just an early look of upcoming Silverlight Model-View-ViewModel Toolkit. I know that this is very early state but I’m writing about this here because I would like to get the feedbacks from the community so that I can prioritize the plans based on what the community want. If you are a fan of WPF MVVM Toolkit then you will probably like it.

Silverlight MVVM Toolkit

Download : SilverlightModelViewApplication.zip (15 KB)


The toolkit includes:

  • A Visual Studio 2008 Project Template
  • Silverlight Command Implementation
  • ViewModelBase that implements INotifyPropertyChanged interface

What is Silverlight MVVM Toolkit?

Silverlight MVVM Toolkit is a Visual Studio project template that has some useful pre-written implementations for Silverlight Command and INotifyPropertyChanged interface. The main intention of creating this toolkit is to help developers to develop the MVVM pattern-based Silverlight application quickly.

I’ve been using this template since a few weeks ago and I found it quite useful because whenever I need to create some samples for my blog or the POC projects for my Office, I always need to create a ViewModal class that implements INotifyPropertyChanged interface and need to add the Prism V2 assembly as a reference in my sample for using DelegateCommand. When I look at WPF MVVM toolkit, I really like it because it saves a lot of my times for copying and pasting the old code from my old sample to new sample. After using WPF MVVM toolkit, I was thinking why not create a project template for Silverlight as well. and now, I did it.

The project template is already attached in this post so you can download and test it in your machine. The msi file for that template is not ready yet but I will show you very simple steps (just two steps only) to make it visible in Project Template Dialog of Visual Studio 2008.

How to install Silverlight Model-View-ViewModel Toolkit

Please download the zip file (Don’t extract it) and close all Visual Studio 2008 instances before following the steps below ~

Step #1: Copy and paste SilverlightModelViewApplication.zip under this path below

%ProgramFiles%\Microsoft Visual Studio 9.0\

VS Project Template

Step #2. Open Visual Studio 2008 Command Prompt and type “deven /setup”

Command Line

Yes. That’s all for installing new project template for Visual Studio.

Once you have finished registering new project template, you open the Visual Studio 2008 and check “New Project” dialog.  Then, you will get new project template “Silverlight Model View Application” under Silverlight project type as shown in picture below.

Silverlight MVVM Template in VS

Choose that template to create a Silverlight MVVM appliction. Note that linking with ASP.NET project, enabling the RIA service and generating unit-test project are not availble in this template but I will add all of this later.

The structure of Silverlight MVVM project is as below.

Silverlight MVVM Folder Structure


Let’s talk about classes under Commands.  The Command implementation that I’m using in this toolkit is from CompositeWPF version 2. I know that I can probably roll my own implementation but I’ve been using Prism for long time and DelegateCommand is working perfectly fine so I dont think that I need to waste my time to do the duplicated things. Please feel free to let me know if you found something that is not supported by DelegateCommand.

Here is the examples for using DelegateCommand.



Here is how you can use Command Binding and CommandParameter in Silverlight.  ( The earlier implementation of Prism v2 is cmd.Command.Click but Prism team re-named this to Click.Command at drop 9.  You can read this post if you like to know why they did the changes)

cmd:Click.Command="{Binding SearchCommand}"
cmd:Click.CommandParameter="This is a CommandParameter"


public DelegateCommand<string> SearchCommand { get; set; }  

public MainPageViewModel()

SearchCommand = new DelegateCommand<string>((arg) =>


INotifyPropertyChanged implementation

Some of you might know that I wrote about how to implement INotifyPropertyChanged interface with Expression Tree so you don’t need to use any magic string in property setter.  If you haven’t read it yet, please go and read this post to get some idea. I implemented the same implementation in ViewModelBase class of this toolkit so you can probably use this feature as below in ViewModel class.

//Example: How to use RaisePropertyChanged without having any magic string.  

private string name = string.Empty;

public string Name
get { return name; }
set {
name = value;
this.RaisePropertyChanged(p => p.Name);

Upcoming Features ~

  • A Project Template Waziard for linking with ASP.NET, enabling RIA Services and generating a Text project that has the references o Silverlight Unit Test Framework and Silverlight Moq
  • A C# and VB.NET project template that supports all editions (inlcuding express edition) of Visual Studio 2008
  • Creating a msi installer by using Windows Installer XML (WiX) toolset


I have a few questions for you guys.

  1. What kind of functionalities do you guys like to see in this toolkit? For example: Extensions/Attached properties, Utilities and etc
  2. Do you think that I should create an installer (msi) for that? OR is it okay to have zip file and register it by youself with two simple steps? I’m asking you this because in order to create a msi, I will probably need to spend some times for learning Windows Installer XML (WiX) toolset. So, if you guys are okay with two simple steps, I can work on other things first.

Feel free to drop a comment if you have any comment or suggestion for this toolkit. If you already have similar things in your mind, please let me know. We can work together to contribute our community. You can also reach me with this email mchlsync AT gmail DOT com.

I will be hosting this project in codeplex.com once it’s ready.



Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}