MVVM

Visual Studio INotifyPropertyChanged Snippet

February 11th, 2010 / Tech Tock

I just made my first Visual Studio snippet.  It’s really easy.

There’s a consensus developing that says dependency properties are usually too heavyweight and people are using INotifyPropertyChanged instead.  I miss the snippet that creates a dependency property, so I made a similar snippet for INotifyPropertyChanged.  You can download the code here.

To make a snippet, just go to Tools / Code Snippets Manager and find a snippet to start with.  I started with the “Define a Dependency Property” snippet since I was doing almost the same thing.  The Snippets Manager will tell you where that file is:

Advance Your Composite Application MVVM to the Next Level – Use Attributes to Automatically Populate Your View Model with Service Calls

December 6th, 2009
Abstract

MVVM is a proven design pattern in WFP/Silverlight world. Its use helps achieve separation of concerns, frees UI from any logic to enhance testing, and generally makes the code easier to understand and maintain. In many LOB multi-tier applications MVVM is extended to include a presenter class. Presenter usually controls the view model, receives necessary services from dependency injection container and has some logic to populate the view model with business entities and/or reference data and send any changes back. The resulting code is usually pretty clean, easy to maintain and test. This article argues though that most of the code in such presenters to populate the view models is also very mechanical, routine, boring and can be avoided all together by introducing small attribute-based view model framework to declaratively populate view models from service calls and avoid extra coding, and, thus, avoid writing extra mechanical, routine, and boring tests.

From Winforms to WPF MVVM in 90 Minutes

November 21st, 2009 / Tech Tock

Jason Dolinger made an excellent MVVM presentation last year.  It starts with a classic WinForms approach then upgrades it to a proper MVVM (Model-View ViewModel) pattern for WPF.  If you’ve ever created a WinForm app (even in VB6 – remember VB6?) and you’ve done your homework about WPF, this presentation will show you how to make a clean, properly separated and testable UI with MVVM.  I worked along with the presentation upgrading a small application I had written — that will take a bit more time, but it’s a great way to really learn.

More details here.