About a year ago, I was contacted by this uber sharp American guy called Ian Johnson, who asked me if I would be so kind as to review his upcoming Windows 8 MVVM library. I stated that I was currently on holiday, but when I got back I would be glad to. Now I have been in pretty much constant contact with Ian over the past year and have been fielding his questions, and we have even written a joint article (Expression API Cookbook) . What immediately struck me about Ian's framework (here after known as StyleMVVM) was how feature rich it was, and how well thought out it all was. Remember I have taken time to look at his code base.
At the time, I was lucky enough to be asked to be an advisory member for the new PRISM offering for Windows 8 code name “Kona”. I didn’t really have enough time to do much on this but it was still an honor. Though I have since spent quite a bit of time getting to known “Kona” now known as “PRISM for Windows Runtime“.
Now I love PRISM and have nothing but respect for that team, and previous team members, but I have to also say at the moment, I prefer the StyleMVVM offering, as I think it is just more feature rich, and some of the code seems to be better to use than PRISM for Windows Runtime.
One thing I really liked in StyleMVVM was the fact that Ian had written a Expression Tree (fast as hell) IOC container from scratch. He has bench marked this and it is rihgt up there, with speeds far exceeding Castle / Unity and AutoFac. It is based around the MEF style attribute model, but fluent registration is also happening any second now (I know I have seen the beta versions of it, and it looks very cool). Ian is very proud of this piece of StyleMVVM, and rightly so, it's awesome.
Now that is no small thing, for a single individual to come up with a framework as feature rich as one of the big boys in the MVVM arena, kudos to Ian.
I believed in Ian's work so much I have been working on a demo app using it in my spare time. This demo app will be the source for a series of articles on how to use StyleMVVM which I hope to have out there in the wild very soon. You will hear about it here. In the mean time, I just want to list some of the features of StyleMVVM, which I have shamelessly stolen from the StyleMVVM Codeplex site.
Some of the core features are:
StyleMVVM
is the only MVVM toolkit for Window Store App that supports all three development languages C#, C++/CX and HTML/JS. Allowing you to export components written in C++/CX and import them into a C# applications. - Built in validation engine that supports
ValidationAttributes
, Fluent validation and method validation depending on your needs. You can validate ViewModel
s as well as DataModel
s. - Conventions module to allow for easier development, as well as templates to setup your project to use conventions.
- Event Handlers can be easily hooked up to your view model using the simple syntax
View:EventHandler.Attach=”EventName => ViewModelMethod($sender,$eventArgs);
etc…” - Supports Regions similarly to Prism with region registration happening in XAML and navigation being driven from the
ViewModel
- Attribute Based IoC container (
Export
, Import
), container is also environment aware and sorts exports accordingly returning the best match at Locate time (RunTime
, DesignTime
, UnitTest
). - Fluent interfaces for configuring IoC Container programmatically (required for C++/CX and Windows Runtime Components)
- Design time
ViewModel
support. ViewModel
s are located at design time using IOC so you can use your real ViewModel
and replace your IDataService
with a Faux version for Design
and UnitTest
. - Auto Registration of Views & WCF Clients (i.e., all classes inheriting from
ClientBase<T>
& Page
) - Implementations for
ICommand
and Attached Event Commands. - Messenger service that is Dispatcher Aware (i.e., handlers are called back on the proper dispatcher)
NavigationViewModel
that is tied into the Metro Page Navigation system (supporting Navigate
method & Navigation Events) - Extensible logging solution
- Configuration service that is expandable by Exporting the
IConfigurationStorageProvider interface
- Improved Suspension Manager (auto adds
DataContract
classes to KnownTypes
) IMessageBoxService
& IFilePickerService
wrappers that allow you to mock out your dialogs for Design and Unit Testing purposes ICharmService
make creating flyout easy by automatically registering charm controls with the SettingPane
. ITileService
, IBadgeService
, & IToastService
allow for easy updates of tiles and toasts. IActivationService
that can create or clone any Object
(satisfying Imports and message registration) ITransformService
can transform data objects from one type to another using reflection and Linq Expressions, you can use the Transform
attribute to give the service hints on how to transform the property. - Visual Studio Template for Projects and Items
So you can expect to see some more material on how to use StyleMVVM very soon. If you just can’t wait, grab the code and have a look at the demo, which is very good and showcases most of the features very nicely.