WPF Application Framework (WAF) and Caliburn are two open source frameworks offering the foundation to developers to write WPF/Silverlight applications based on the Model-View-ViewModel (MVVM) pattern using a layered architecture.
WAF uses the Model-View-ViewModel (MVVM) pattern, which is quite similar to the PresentationModel, as defined by Martin Fowler. This pattern, as used by WAF, can be described by the following UML diagram:
View – this class contains all the GUI widgets, but not their state nor behavior.
IView – an interface for the View class.
ViewModel – contains the state and behavior for the GUI widgets. The reason those elements are saved here is to avoid tying the application code to the GUI interface, so the application can be easily ported to a different GUI system. The ViewModel can interact with View through its interface.
Controller – The MVVM pattern does not mention a controller but WAF contains one, having the responsibility to direct the flow of the application. If necessary, ViewModel informs the Controller on changes through events.
Model – An underlying domain class. Changes in the Model are transmitted to the View or ViewModel via events.
WAF is built with a layered architecture in mind as the one presented below:
The framework contains basic classes/interfaces which are to be extended to fit the application, such as Controller, IView, ViewModel, Model, and also a number of file dialog/message service classes. The framework also comes with code samples for a book library, an email client, a document oriented application, and also basic support for unit tests. WAF has been submitted to CodePlex by user jbe2277, which did not decline his identity, but he seems to be a developer on the Microsoft pattern&practices Smart Client Contrib team.
Caliburn is yet another open source WPF and Silverlight framework, built around the same MVVM pattern. The project’s website mentions the following features:
- Extends data binding to methods, making MVVM architectures simple and intuitive.
- Adds pre/post execution filters and rescues to MVVM actions.
- Simplifies asynchronous programming through a powerful implementation of co-routines.
- Provides base classes supporting common UI roles such as Screen Activator, Screen Conductor, Screen Collection and Application Controller.
- Encourages a convention over configuration approach to architecting solutions.
- Supports TDD by providing a powerful data binding validation framework for WPF.
- Enables use of the same API for WPF and Silverlight architectures
The framework seems to be similar to WAF in many ways but it is more mature having over 100 classes/interfaces. It also comes with Silverlight and WPF samples such as a Contact Manager and a Game Library. Caliburn is backed by Blue Spire.