About a year ago, I wrote an article for SilverlightShow, titled “A Designer-friendly Approach to MVVM”. The article introduced VSMChangerBehavior which allows tying enums in the ViewModel to Visual States in the View. Another Action shown off there is the CallDataContextMethodAction, which calls a method in the DataContext with a twist – if such a method is not found, it can travel up the visual tree, and call the methods there.
We have used both the VSMChangerBehavior and the CallDataContextMethodAction in many projects since. We fixed a couple of bugs, and today, we are releasing them as a NuGet package to make it easier than ever to add these handy utilities to your project.
The package supports WPF, Silverlight and Windows Phone 7 projects. We are also publishing another package with a sample control and ViewModel to show off how the workings.
To add the package to your project, do the following:
- Install the latest NuGet package manager from www.nuget.org. (this package requires V1.2)
- Open a WP7, WPF or Silverlight project
- Right click on References, and click Add Library Package Reference

- Search for the package called “Response.MVVM”

- Click Install to install the library or the sample. The sample also installs the library, and adds the Samples\Response.MVVM folder to your solution :

- To see how it works, add the SampleControl.xaml to your application, and run it. Here it is in a Windows Phone 7 application:

That’s it! Enjoy!
Posted
Mar 31 2011, 12:34 PM
by
vbandi