Disclaimer: It has come to my attention that there is some confusion in the community regarding the “official status” of the WPF Starter Kit. I wanted to make it clear that this toolkit has come out of my and my team’s efforts on a recent project and is by no means the endorsed (by Microsoft) or only way of implementing the features outlines below. The p&p team’s Composite WPF and Silverlight guidance (http://compositewpf.codeplex.com/) and the WPF codeplex site (http://wpf.codeplex.com) are the official sources of guidance. Another source of inspiration to me has been the people and articles of http://wpfdisciples.wordpress.com/. There are a bunch of community-created MVVM toolkits out there, and most are as valid as this one.
If you’re looking to get straight to the code, go here: http://wpfstarterkit.codeplex.com/
I have been working on a WPF project the last few months. We’ve managed to accomplish something pretty incredible by putting a WPF application at the center of a hostile environment (a train engine) paired with a ruggedized tablet. The tablet itself ships with Windows XP Tablet Edition (talk about being behind the times!) but the great thing about WPF as a platform is that this didn’t matter so much. We were still able to build our application and deploy it on the tablet as well as on Windows 7 desktops with only minor issues (most of them to do with the graphic drivers on different video hardware).
When I started out with this application I really wanted to use the Model View View Model pattern. Not only because MVVM is the hot new pattern (which it admittedly is) but also because I think MVVM is what MVC always wanted to be. Of course, WPF’s brilliant data binding and commanding support only helps. We did evaluate what was then known as Prism (http://compositewpf.codeplex.com/) but found it a little too complicated for a project this size (the application only has about 30 views). Another thing that didn’t fit was the large learning curve. Most of the people on the project, while quite well versed with managed code, were new to the WPF way of doing things.
That was when I made the decision to build a up a barebones, simple MVVM/Navigation/Commanding framework that would be easy to pick up in a single afternoon. While it does not have the modularity, complexity or extensibility of Prism, it worked very well for our application. Here’s what the WPF Starter Kit supports:
A simple, easy to use implementation of the Model View View Model pattern
- A navigation framework that allows for clean navigation between View/ViewModel units. This framework is based on built-in WPF navigation
- Support for passing data between View Models
- Support for generic exception handling
- Support for long running operations on the UI thread
The source code for the project is here: http://wpfstarterkit.codeplex.com/. Feel free to log bugs if you find something not working. There’s also a presentation that should make it easy to get started using the kit: http://wpfstarterkit.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=35301#DownloadId=90586. Finally, there is a sample project in the solution that shows off each of the features mentioned above. I’ll try and make separate posts covering each of these features and tasks you’d normally need to perform while writing a functional multi-view application with the WPF Starter Kit.