I’ve been working with MVVM on WPF applications for well over a year now on two major projects. As the UI architect for both projects, I was the guy who had to figure out how to make things work in a way that was extensible and testable. With each WPF project I did that leveraged MVVM, I found there were common problems that needed to be solved. These common problems include communication between views, decoupled/testable navigation between views and commanding. To solve these problems, I initially developed a solution and refactored as needed to fit the different scenarios I encountered.
After spending over a year with the solution, I feel that it stabilized well enough to be confident that I had the foundation for a more general purpose solution. I have taken what I did on both projects and what I learned from them while doing it and created a library that I am calling MVVM Fabric. The (mostly selfish) goal with MVVM Fabric was to create an MVVM library that I could weave into other projects with minimal effort.
The real trick was taking what I had integrated into my most recent project and extracting it in such a way that I could turn it into a library and keep it usable.
What is MVVM Fabric?
MVVM Fabric is the result of that exercise. It is a WPF-centric library, written in C# 4.0, which helps address communication, navigation and commanding in an application leveraging MVVM. It provides core functionality and leverages dependency injection to provide extensibility.
I have posted the library along with a sample application which uses it out on github: https://github.com/brentedwards/MvvmFabric.
If you have attended my presentation WPF with MVVM: From the Trenches or looked at the presentation materials, you will likely notice many similarities. That presentation and the resulting sample application were both based on the same projects as MVVM Fabric. So, I refactored that sample application to eat my own dog food and work out some kinks. The result is something that I am happy with, though will likely be further extended as I (or you) see fit.
I plan to write several blog posts to provide a more in-depth introduction and explanation of the library (and reasons behind the decisions I made) in coming days.