MVVM Light Toolkit V2: What’s new?

.NET, Blend, MVVM, Silverlight, Work, WPF
See comments

I am happy and proud to announce that the MVVM Light Toolkit V2 has been published!

Shortcut: Jump directly to the installation instructions.

Excerpt from the Get Started page:

The main purpose of the toolkit is to accelerate the creation and development of MVVM applications in WPF and Silverlight.

Like other MVVM implementations, the toolkit helps you to separate your View from your Model which creates applications that are cleaner and easier to maintain and extend. It also creates testable applications and allows you to have a much thinner user interface layer (which is more difficult to test automatically).

This toolkit puts a special emphasis on the “blendability” of the created application (i.e. the ability to open and edit the user interface into Expression Blend), including the creation of design-time data to enable the Blend users to “see something” when they work with data controls.

What’s new?

So what is new in V2? Here is a list that should help you adapt your existing applications to the new version.

New Messenger API

The major change in this release is the new and improved Messenger class. The API has been reworked and simplified to make sending and registering for messages a one-liner each. Any type of message can now be sent, from simple values (int, double, string etc…) to complex messages.

The old methods are still available, however they have been marked Obsolete, which will cause warnings to appear in the Output window of Visual Studio when you build an existing application. I encourage you to upgrade to the new API, which should be quite harmless and rewarding.

There is also an IMessenger interface that the Messenger implements, which makes mocking and testing easier.

The new methods are described in an existing blog post, and additional blog posts around this component will follow.

Expression Blend templates

The MVVM Light templates (project templates and item templates) are now installed for Expression Blend 3 too. You can create and run new MVVM Light applications in this fantastic tool. With the help of the Blend source code editor, you can even consider writing simple MVVM applications without using Visual Studio at all (though for more complex applications, this might prove difficult).

More information about creating new applications in Expression Blend can be found in a related article.

Never miss a new version!

I wanted to make a small application to help you check really fast if a new version of the MVVM Light Toolkit is available for download. Simply choose Start / MVVM Light Toolkit / Check Version On Server, et voila. It’s simple and fast (of course, an Internet connection is required ;)) More information about this application is available here. Oh, by the way, this is, of course, an MVVM Light application.

Easier to find in the Start menu

The shortcuts for V1.1 were installed in Start / All Programs / Laurent Bugnion (GalaSoft) / MVVM Light Toolkit. This was not very convenient, and made them more difficult to find than it should be. I changed this, and the shortcuts are now under Start / All Programs / MVVM Light Toolkit.

Note: The V2 installer attempts to delete the shortcut folder “Laurent Bugnion (GalaSoft)”, since it is not needed anymore. Depending on your system’s configuration, this step might be unsuccessful, and you might have to delete this shortcut folder manually.

Minor changes

A few minor changes have been made, that shouldn’t affect the way that the Toolkit works, but make things a bit cleaner:

  • The method RelayCommand.RaiseCanExecuteChanged(bool) has been marked Obsolete and replaced by RelayCommand.RaiseCanExecuteChanged(). The parameter was not really necessary and has been removed.
  • In the “Add new project” dialog in Visual Studio, the WPF project template has been moved from “MVVM” to “Windows / MVVM”. It makes more sense to put all the WPF content under the Windows category.
  • In the project template for WPF, I moved the resource dictionary “Skin.xaml” to a folder named “Skins” and I renamed the file “MainSkin.xaml”.
  • For consistency, in Silverlight, I also added a “Skins” folder in the project template, and moved all the resources from App.xaml to MainSkin.xaml. Note that this features will not work in Silverlight 2 applications (but hey it’s time to move on, right?).
  • Cosmetic changes: Quite a few small improvements (“polish”) have been made to make the experience (installing and using the toolkit) more consistent and clean.

Bugs corrections

There were a few issues with V1.1 that have been corrected in V2:

  • A scenario I had not envisioned was causing issues: When a recipient would receive a message, and in the method handling that message would register another recipient for the same message type, an Exception occurred. This bug has been corrected and unit tests added to verify this behavior.
    Thanks to Laurent Kempé for finding this one and helping me solve it, and to Innoveo for giving him some time to do this.
  • The property ViewModelBase.IsInDesignMode was returning false all the time when the assembly was compiled in Release mode. The value is now correct in Debug and Release modes.
  • (Silverlight only) When a RelayCommand was bound to a control, the control was not disabled properly if the command’s CanExecute method was returning false before it was bound.
    Props go to Corrado Cavalli for finding this bug.
  • The manual step that was required when creating a new Silverlight MVVM Light application is not required anymore. I modified the project template to take care of this.


With these changes, the MVVM Light Toolkit should be easier to use, which is my main goal and the motivation that drives me.

In next releases, new components will be added to make MVVM application development more fun and enjoyable. I am very careful when I add a new component to the toolkit to keep it “light”. The MVVM Light Toolkit is not a “solution to all the problems”, and never will be. It does, however, make it quite easy to start creating clean applications in Silverlight and Windows Presentation Foundation. Its stated goals (improving the blendability of applications, making them easier to test, separation of concerns, avoiding “component overload”) are, I hope, respected. I encourage you to give me feedback (many already did, and I am grateful for that) and new ideas.

Previous entry | Next blog entry

Comments for MVVM Light Toolkit V2: What’s new?