Project Description

Simple MVVM Toolkit makes it easier to develop WPF, Silverlight, Windows Store, Windows Phone, iOS and Android applications using the Model-View-ViewModel design pattern. The purpose of the toolkit is to provide a simple framework and set of tools for getting up to speed quickly with applications based on the MVVM design pattern. The emphasis is on simplicity, but it contains everything you need to implement MVVM for real-world line of business applications.

Donate to the Project

Donations to Simple MVVM Toolkit are now being accepted!  You can contribute one of three amounts: $10, $15 or $25.  What a deal. Smile   Just click on the link below in order to pay via PayPal account or by credit card.  The good news is that having a revenue stream will allow me to spend more time updating the project, improving the developer experience, and adding new features and support for additional platforms.  I will also be able to create new tutorials and screencasts.

Simple MVVM Project Donations

What’s Hot

Version 5.5 of Simple Mvvm Toolkit now supports iOS and Android!  There is also support for creating Portable Class Libraries that contain view models shared across multiple platforms: WPF, Silverlight, Windows Store, Windows Phone, iOS and Android.  There is a terrific multi-project Visual Studio template for creating a multi-platform solution with portable models, view models, service agents and locators.

Simple MVVM Toolkit v5 now supports Visual Studio 2013! Use v4 to develop MVVM apps for WPF 4.51, SL5 (including Ria Services), Windows Store 8.1 and Windows Phone 8.  If you are still using Visual Studio 2010, which is required for Windows Phone 7 apps, then install Simple MVVM Toolkit v3.

Simple MVVM Toolkit v5 for Visual Studio 2013 is built using Portable Class Library tools, so that it will be easier to add support for multiple platforms. All NuGet packages have now been consolidated into a single package: SimpleMvvmToolkit v5.0.  These are loaded automatically into the VSIX installer.  Code snippets will be released in a separate installer.

Take a look at the Getting Started screencast!

You can watch it now or download the screencast to watch it offline on your pc or mobile device.

gs-screencast

View the Real-World MVVM with RIA Services Screencast:
Real-World MVVM Part 1 Streaming or Download (PC or mobile device)
Real-World MVVM Part 2 Streaming or Download (PC or mobile device)

Simple MVVM Toolkit can be downloaded from within Visual Studio by selecting the Tools menu, Extension Manager!

smvvm-vsext

Simple MVVM Toolkit now has an installer!  Just download and run it.

SimpleMvvmInstaller

Simple MVVM Toolkit has some awesome Visual Studio project templates!

mvvm-proj-sl4

From within Visual Studio, select File, New Project, then click on the Mvvm category under either Windows (for WPF), Silverlight, or Silverlight for Windows Phone.  After clicking OK you get a complete project with a folder structure and a ready-made MVVM app.

smvvm-sl

Here is what you get from the Silverlight project template.  Just follow the instructions in ReadMe.txt.

smvvm-ria

Here is what you get from the RiaServices template.  Just hit F5 and you’ll see a fully functional MVVM Silverlight app that uses WCF RIA Services.

smvvm-riarun

The kicker is that you also get a Test project that uses the Microsoft Silverlight Testing Framework.

smvvm-testrun

Features

New Features in v2:

  • An Installer that places the binaries, templates and snippets in all the right places.
    • Copies binaries, libraries, samples and source code to one location
    • Copies Visual Studio templates and code snippets to the correction location
    • Registers the binaries so that SimpleMvvmToolkit appears in the Visual Studio Add References dialog.
  • Visual Studio project templates
    • Project templates for Silverlight, Windows Phone and WPF, which include starter Locator, Model, ViewModel, View and ServiceAgent classes.
    • A multi-project Visual Studio template that includes a Silverlight client, a Silverlight Unit Test project and a WCF RIA Services project.
  • The main sample now has Parts 2 and 3
    • Part 2 demonstrates navigation, messaging, property associations, async
    • Part 3 demonstrates using the toolkit with WCF RIA Services, including persistence with CRUD operations
  • Simplified and consolidated ViewModelLocator template which creates ViewModels on-demand.
    • This allows Views to control the ViewModel lifetime, avoiding potential memory leaks
    • Silverlight and Windows Phone apps use the same ViewModelLocator template
    • The code snippet to insert injected (for dependency injection using MEF) ViewModels is more robust
  • Improved support for unit testing (with the Silverlight Unit Testing Framework – included in the Silverlight Toolkit)
    • Includes an extension method for enqueuing  conditional tasks with a timeout
  • Simpler and more robust MessageBus
    • Now uses leak-proof eventing model so that unregistering for messages is no longer required
    • ViewModelBase now includes helper methods for sending and receiving messages
  • GenericDelegateCommand supports parsing string parameters from XAML
    • Plays nicer with CommandParameter in XAML

Other Features:

  • Support for Silverlight, WPF and Windows Phone 7
  • Helper classes, Visual Studio templates, code snippets
    • Helpers: Model and view-model base classes, MessageBus,
      DelegateCommand, MEF Export attribute
    • Templates: View-model, detail view-model,
      view-model locator, injected view-model locator
    • C# Code Snippets: bindable property, vm locator, command
    • XML Code Snippets: Blend event-trigger
  • Sample applications with step-by-step instructions
    • End-to-end Silverlight Mvvm sample using WCF
    • Simplified “Getting Started” sample
    • Associated properties sample
    • Async execution sample
    • Enum to list conversion sample
    • Message bus sample
    • Navigation sample
    • Dependency injection (MEF) with unit testing
  • Model and ViewModel base classes
  • Strongly typed data binding with lambda expressions
  • View-model locator service
  • DelegateCommand based on ICommand
  • AssociateProperties method to link view-model and model properties
  • Event-based facility for two-way communication between views and view-models
  • MessageBus for sending notifications in a loosely coupled fashion among view-models
  • Dependency injection (IoC) for unit testing using MEF (Managed Extensibility Framework)
  • IEditableDataObject support with deep cloning
  • Conversion of enums to lists for populating combo boxes
  • Async support with transparent marshaling to the UI thread
  • Built-in support for WCF RIA Services

What You Get

The toolkit consists of a set of helper classes, some Visual Studio templates, and a set of code snippets. All you have to do is reference the helper assembly (or include the Visual Studio project in your solution), add view-models using the Visual Studio item templates, and insert properties using the included mvvmprop code snippet. The view-models extend a base class that supplies two-way data binding. There is also an item template for a detail-based view model that extends a base class with editing capability (via IEditableDataObject). You can also add a view-model locator using the corresponding item template and code snippet.

Getting Started

The best way to get started is to open the Getting Started sample in Samples\SimpleMvvm-Other and follow instructions in the Getting Started section of the online Documentation for creating a Silverlight MVVM application from scratch using the toolkit.

After creating your first app, you’re ready to explore the main sample app.  Open up Before and After versions of the sample application included in the downloaded zip file. There is a ReadMe.txt file with detailed step-by-step instructions. The Before solution is an n-tier application that retrieves products and categories from the Northwind sample database using a basic WCF service. (In case you'd like to reproduce the Before project, there is a text file describing how to do that.)

Next you can check out samples for async execution, associated properties, enum to list conversion, notifications using the Message Bus, using view-model driven navigation, and dependency injection with unit testing.

About the Author

Tony Sneed is an instructor for the developer training company, DevelopMentor, where he authors and teaches courses on .NET 3.5-4.0, Entity Framework, Windows Communication Foundation and Silverlight.  He has a keen interest in MVVM, Managed Extensibility Framework, and WCF RIA Services.  You can read his blog or follow him on Twitter and Facebook, where he has created a group for people using MVVM to design Silverlight applications.  He is a frequent speaker at user groups and conferences and has written articles for MSDN Magazine.

What's Next?

I plan to put out additional blog posts and a series of screen casts on using the Simple MVVM Toolkit and exploring different features.

Last edited Feb 4 at 5:33 PM by tonysneed, version 44