Click here to Skip to main content
15,889,281 members
Articles / MVVM

WinRT: StyleMVVM Best Of Breed MVVM Framework (IMHO)

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
3 Mar 2014CPOL4 min read 10.5K  
WinRT: StyleMVVM Best Of Breed MVVM Framework (IMHO)

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 ViewModels as well as DataModels.
  • 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. ViewModels 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.

This article was originally posted at http://sachabarbs.wordpress.com/2013/10/25/1335

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
I currently hold the following qualifications (amongst others, I also studied Music Technology and Electronics, for my sins)

- MSc (Passed with distinctions), in Information Technology for E-Commerce
- BSc Hons (1st class) in Computer Science & Artificial Intelligence

Both of these at Sussex University UK.

Award(s)

I am lucky enough to have won a few awards for Zany Crazy code articles over the years

  • Microsoft C# MVP 2016
  • Codeproject MVP 2016
  • Microsoft C# MVP 2015
  • Codeproject MVP 2015
  • Microsoft C# MVP 2014
  • Codeproject MVP 2014
  • Microsoft C# MVP 2013
  • Codeproject MVP 2013
  • Microsoft C# MVP 2012
  • Codeproject MVP 2012
  • Microsoft C# MVP 2011
  • Codeproject MVP 2011
  • Microsoft C# MVP 2010
  • Codeproject MVP 2010
  • Microsoft C# MVP 2009
  • Codeproject MVP 2009
  • Microsoft C# MVP 2008
  • Codeproject MVP 2008
  • And numerous codeproject awards which you can see over at my blog

Comments and Discussions

 
-- There are no messages in this forum --