Liberty MVVM Light Series

> Grubin666
> Tutorials
> MVVM
> MVVMLight

Passing Parameters With Behaviors In MVVM Light for Windows Phone. Windows Phone From Scratch #20 MVVM Light Toolkit Soup To Nuts #5 In the previous posting in this series, we created a list of customers and we bound them to a list box.

We did this not in the code-behind but in the View-Model.
Windows Phone From Scratch #19 – MVVM Light Toolkit Soup To Nuts #4. Let’s back up a bit and examine the day to day use of a View Model, and binding to the view model.

In this mini-tutorial I’ll show the basics of binding a collection that sits in a View Model to a list box in the view. In the next, I’ll show how to capture the selection and, in the view model, determine what the details page should show. Let’s create a simple application that will display the full name of customers and their email, and that will (eventually) allow the user to click on one and go to the details about that customer.

We start by creating a new MVVM application for Windows Phone.
Windows Phone From Scratch #18 – MVVM Light Toolkit Soup To Nuts 3. This is the third part of the MVVM Light Toollkit Soup To Nuts (part 1 is here) within the Windows Phone From Scratch Mini-tutorial series.

Today we look at an introduction to messaging as a tool for communicating, e.g., from the view-model to the view. What We’ll Build To illustrate this, we’ll return to the example we began in part 1, and extended in part 2 (you can download the part 2 source code here). As you’ll remember, we were able to convert the click event on the button on MainPage to be a command that is handled in Page 2. We stubbed out the handling of that command, but now it is time to complete the logic, by having the view model cause a navigation from MainPage to Page 2. There is and should be no visibility of a view from a view-model, however, and so we need a mechanism for sending out a message in a bottle to be picked up by anyone who is interested. Messaging Fortunately, the MVVM Light Toolkit provides extensive support for messaging. Build and run the application.
Windows Phone From Scratch #17: MVVM Light Toolkit Soup To Nuts Part 2.

This is the second part of the MVVM Light Toollkit Soup To Nuts (part 1 is here) within the Windows Phone From Scratch Mini-tutorial series.

Today we look at an introduction to behaviors as a tool for migrating event handling from code-behind to the View-Model. Behaviors were originally introduced in Blend to empower designers, but they turn out to be enormously helpful to C# programmers as well. For example, it is a design goal to move as much of the (testable) logic of the program out of code-behind (where testing is more difficult) and into the View-Model. But what to do about events, such as the click event on a button? What We’ll Build. (WPFS) MVVM Light Toolkit: Soup To Nuts Part I.

While I’m not a zealot on the topic, I do believe that MVVM offers one of the best patterns for Windows Phone development and so, moving forward, the Windows Phone From Scratch series will incorporate MVVM in general, and the MVVM Light Toolkit in particular.

I’m more than convinced that MVVM is an essential pattern for Windows Phone Development; and while there are many excellent frameworks to make MVVM development easier, the one I personally prefer to work with is the MVVM Light Toolkit and so it is the one I’ll focus on. I make the case for MVVM in this article, and so I won’t rehash that material here.

Instructions for installing MVVM Light Toolkit are available here. I will not assume any background with MVVM or with the Toolkit beyond those two links. In that spirit, let’s begin by creating a two page MVVM application. Creating the Application To begin, open Visual Studio and click on New Project. Select MvvmLight and name the project MvvmLightNavigationBehaviorAndMessages. Hey!