Tuesday, February 22, 2011

MVVM Light for Silverlight Part 1: Introduction

Introduction

This post is the first in a series that will hopefully provide some useful information on how to use MVVM Light Toolkit in your applications.  The first part in the series is little more than a quick overview of MVVM Light alongside some links to some resources to get you started. I'll shortly follow this up with a part 2.

Reason for the series

Unfortunately there are very few resources out there for people attempting to learn and use the MVVM Light Toolkit. I hope to provide some samples and clear explanations of how to use the MVVM Light Toolkit that will enable you to produce some MVVM applications

What is MVVM Light?

MVVM Light refers to the MVVM Light Toolkit. It is a framework that is intended to help accelerate the creation and development of MVVM applications in WPF, Silverlight and in the Windows Phone 7.

Here is the official project description:
"The MVVM Light Toolkit is a set of components helping people to get started in the Model - View - ViewModel pattern in Silverlight and WPF. It is a light and pragmatic framework that contains only the essential components needed." - lbugnion, creator
One of the nice things about MVVM Light Toolkit is that has support for blend, which is sometimes referred to as Blendability.
"Blendability is just a fancy word for enabling designers to see the correct preview of their Views in Visual Studio and/or Expression Blend. " - Roboblob
When to use MVVM and MVVM Light?

In the end you could use the combination for almost any application. The choice is yours. Where you can potentially benefit? It is suitable for helping to separate the user interface from a lot of the logic and data model(s). It allows you as a developer to separate your code into manageable pieces (Mode, View, View Model). This can, for example, allow the UI to be more independent from the code behind, allowing you to completely swap out or make drastic changes to the UI with little or no impact to data models or logic. When designing the UI you can also see data being filled in your controls without having to run the application or wait for any other additional logic to populate your controls (Blendability).
 
Getting Started

Laurent has a great getting started page that walks you through the installation and setup process here. Setup is extremely easy to accomplish and you only need to reference the GalaSoft.MvvmLight dll to get started taking advantage of MVVM Light. Laurent has also included some templates and code snippets to help make development with the toolkit a little easier.

http://www.galasoft.ch/mvvm/getstarted/

MVVM Light Toolkit & Source code

The Toolkit and source code can be downloaded from the MVVM Light Toolkit Codeplex site.

More Information

If your looking to download the MVVM Light Toolkit, would like to learn more about it, or would like to join in some discussion involving it, click here.

If you need more information on MVVM there are plenty of resources. I suggest you google (it), bing (it), yahoo (it), jounce (it), Wiki (it), or do something else with it.. and start consuming.

Examples and Resources

Currently MVVM Light is currently a little light on the examples. Here on some links I have found that may be useful to you while learning this framework:

Articles and Tutorials by Laurent
- Laurent Bugnion

Silverlight Firestarter 2010 Session 4: MVVM
- John Papa

(WPFS) MVVM Light Toolkit: Soup To Nuts Part I 
- Jesse Liberty

A Sample Silverlight 4 Application Using MEF, MVVM, and WCF RIA Services - Part 1

Apunta Notas - Sample application for WPF

Closing

This should have provided you with a very brief introduction to the MVVM Light Toolkit as well as some resources to help get you started. The next post in the series (MVVM Light for Silverlight Part 2: The Glue) will walk through the sample MVVM Light Toolkit application and explain how it works.

No comments:

Post a Comment