WPF Application Framework (WAF)
MVVM pattern is not framework and doesn't require any framework to be used.
WPF assumes MVVM for most things. e.g. using a the wpf tree control without MVVM will have you tearing your hair out within a day.. MVVM just makes things simpler and testable. This could answer some of the questions: wintellect.com/CS/blogs/jlikness/archive/2010/04/14/….
I would recommend Caliburn. Micro, as it is straightforward to implement following the examples on the Caliburn. Micro documentation page. It also has a very compelling convention over configuration mechanism, and uses an Actions system to invoking verbs (methods) on your view models from the view.
It really depends on what you are trying to achieve, and how much infrastructure you want in place already, plus the ease with which you can find samples that help you out. I'm going to declare an interest here, because I've been actively involved in at least one MVVM framework, and I've had input into others through the WPF Disciples group, so I'm a little bit biased. Saying that, here goes:
Microsofts MVVM Toolkit - this is still very much in the alpha stages. When it was originally released, it took a bit of a savaging from the Disciples because of what it didn't do. Saying that, MS is looking to beef this framework up so it's one to watch - it's just not ready yet.
MVVM Foundation - ah Josh Smith's version of the framework. Josh is one of the daddies of MVVM, and has been a huge advocate and teacher of the pattern. As a result, a lot of what you'll find in other frameworks has Josh's fingerprints all over it. This framework is intended to provide the basics of MVVM, and not to address some of the more esoteric issues. Originally this was intended only for WPF, but people such as Laurent Bugnion and myself have added functionality/projects that mean this will be a Silverlight compatible framework as well.
WAF - no experience of it, so I can't comment on it I'm afraid.
MVVM Light - Laurent Bugnion's take on it, and just updated to version 2. This is a very good framework, but again it's not intended to cover every single aspect of MVVM applications. Given Laurent's background, it has very strong Silverlight and Blendability support in it.
Update Laurent has just informed me that the .NET 3.5 and .NET 4.0 versions are feature compatible. Wau to go Laurent.
Cinch - Sacha Barber's excellent WPF only MVVM framework. This covers more ground than the frameworks I've talked about above. It's an excellent framework, and takes advantage of concepts covered in Bill Kempf's excellent Onyx project. Onyx is intended to complement MVVM frameworks, and adds in functionality that's typically been hard for people to do in MVVM/WPF. Again, originally intended to be WPF only, Onyx has progressed to include SL compatibility - work I am particularly proud to have been involved in.
Prism - Again, I've never used it, but I've heard a lot of good things about it.
Ocean - Karl Shifflett, Program Manager on the Cider team, recently released a fully featured WPF MVVM framework. Again, this is an excellent framework and has lots to recommend it.
The bottom line is, download the different frameworks take a look at them and work out which one fits most intuitively with the way you think and with your requirements. If you think that you might want to support Silverlight from the same codebase then the WPF only frameworks should be discounted.
I found this article very useful http://www.japf.fr/2009/10/a-quick-tour-of-existing-mvvm-frameworks/ So that I bring it here for upcoming users
I update the Cinch section and add silverlight support to its features
I'm sorry for the long story
Common features:
• ViewModelBase class (for the implementation of the INotifyPropertyChanged interface)
• RelayCommand like class to link UI command to ViewModel’s handlers
• Unit tests comes with the framework
Cinch
• Author: Sacha Barber
• Silverlight support: no (Cinch version 2 supports Silverlight)
• Documentation: excellent, 6 articles published on CodeProject
• Hosting : CodePlex
• License: Code Project Open License
• Features:
attached behaviors
validation using IDataErrorInfo
support for IEditableObject
weak events creation and subscription
mediator messaging using weak events
IOC/DI support (using Unity)
services: event logger, message box, open save dialog, popup
threading helpers
support for menu items
closeable viewmodels
MVVM code generator
MVVM Light Toolkit
• Author: Laurent Bugnion
• Silverlight support: yes
• Documentation: many articles available on Laurent’s blog + other developers as well
• Hosting: CodePlex
• License: MIT license
• Features:
MSI installer
VS project and item template
VS code snippets
Messenger system for inter-viewmodel communication
Handling events as commands
MVVM Helpers
• Author: Mark Smith
• Silverlight support: no
• Documentation: some articles on Mark’s blog
• Hosting: personal website
• License: not defined
• Features:
attached behaviors
viewmodel creation using markup extension
attributes based validation
IOC/DI using ServiceProvider approach
closeable viewmodel
wait cursor (using new WaitCursor() { // your code here })
MVVM Foundation
• Author: Josh Smith
• Silverlight support: no
• Documentation: articles about the Messenger implementation on Josh or Marlon Grech’s blog
• Hosting: CodePlex
• License: MS-PL
• Features:
Messenger system for inter-viewmodel communication
PropertyChanged event monitor
Caliburn
• Author: Rob Eisenberg
• Silverlight support: yes
• Documentation: complete online documentation available
• Hosting: CodePlex http://www.codeplex.com/caliburn
• License: MIT license
• Features:
commands are built on top of Actions and thus share many of the same features, including multiple input parameters, filters and automatic asynchronous execution
presenters that handles UI lifecycle issue such as handling activation, deactivation and shutdown semantics for various UI components
Caliburn applications are fully testable
various utilities such as a background task manager
supports various UI pattern (not MVVM only)
dependency injection container
Onyx
• Author: William e Kempf
• Silverlight support: no
• Documentation: basic introduction available on CodePlex
• Hosting: CodePlex
• License: not specified
• Features:
ServiceLocator pattern
ViewModel creation using a custom markup extension
UI related services such as IDisplayMessage
Calcium
• Author: Daniel Vaughan
• Silverlight support: no
• Documentation: 2 very detailed articles on CodeProject (part1 and part2)
• Hosting: CodePlex
• License: use, copy, modify, and/or distribute and keep the copyright!
• Features:
Module Manager for enabling or disabling of modules at runtime
messaging services for interacting with the user from the client or server using the same API
Command Service to associate WPF ICommands with content interfaces that only become active when an active view or viewmodel implements the interface
Region Adapters for ToolBars and Menus
Client-server logging ready to work out-of-the-box
Includes modules, such as a Web Browser, Text Editor, Output Window, and many more
Tabbed interface with dirty file indication (reusable across modules)
nRoute
• Author: Rishi
• Silverlight support: yes
• Documentation: many articles available on author’s blog (see CodePlex project home page for the links)
• Hosting: CodePlex
• License: MS-PL
• Features:
support Blend3 behaviors and triggers models
resource locator framework
view services: OpenFileDialog, ShowMessage…
uses attributes to map View and ViewModel together
Nito MVVM
• Author: Shammah
• Silverlight support: no
• Documentation: no
• Hosting: CodePlex
• License: not specified
• Features:
- various MVVM friendly implementations of the ICommand interface
Ocean
• Author: Karl Shifflet
• Silverlight support: no
• Documentation: articles available on Karl’s blog
• Hosting: personal website
• License: not specified
• Features:
written in VB.Net
attribute based validation
viewmodel base classes: relaycommand, closeableviewmodel…
SQL server data access layer
Basic MVVM framework
• Author: Lester Lobo
• Silverlight support: no
• Documentation: sample application available with the library
• Hosting: CodePlex
• License: MS-PL
• Features:
delegating Commands\Keybinding
messaging between VM’s
handling events as commands with attached behaviors
handling dialogs (and more) as services
VS code snippets
GoodLight
• Author: Peter O’Hanlon •Silverlight support: yes
• Documentation: sample application available with the library
• Hosting: CodePlex
• License: MS-PL
• Features:
“workspace” management (set of document that can be closed)
skin support
messaging between VM’s
I try to describe the Frameworks missing in Pete’s great answer:
MVVM Toolkit (Microsoft) is a very lightweight library with Visual Studio project templates that should support beginners with this pattern. If Microsoft gets good feedback for their Toolkit then they might implement this as a new Visual Studio (maybe 2010) project template.
Prism (Microsoft p&p) is a framework that provides more than the support for the MVVM pattern. The main goal of this project is to help you to build modular WPF and/or Silverlight applications. When you just need to implement the MVVM pattern or you are a beginner in .NET/WPF I won’t recommend this project. See also: Link.
WPF Application Framework (WAF) is a lightweight framework that helps you to create WPF apps with MVVM. It’s just for WPF and so it doesn’t support Silverlight. It goes a bit another way than most other MVVM frameworks with the introduction of Controllers. They are responsible for the application workflow and they mediate between various ViewModels.
Meh. Mvvm doesn't really require an entire framework to support IMO. If you understand the concept, it's pretty straightforward to start off with a clean VM baseclass that implements INotify, and just go from there.
Also look at:
Caliburn & Onyx!
Mix your own!
I used EventAggregator from PRISM, with ViewModelBase from MVVM foundation and so on. I also tweaked the RelayCommand (DelegateCommand called in some places) to accept other data too, and so on.
I wouldn't recommend just one framework per se.
my bet will be on Caliburn and MVVMlight, it seems that not many of these mvvm frameworks support silverlight. I can foresee that there will be more MVVM frameworks to choose from than the IoC frameworks, because it is harder to set up the feature boundary to the mvvm framework. I guess the best way to find out which one is better suit your project will be by listing/comparing their features.
Also check out Mix10. I learn a lot from the talk : building your mvvm framework.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With