Tag Archives: WPF

EventToCommand + DataStateBehavior eases MVVM pain


MVVM is a pattern.  There are all sorts of MVVM frameworks popping up that help make implementing the pattern easier.  If you select the MVVM tag off of www.codeplex.com, you will find a number of them:


One I have recently grown fond of is http://mvvmlight.codeplex.com/.  The reason I like this one is because they have built an Expression Blend Behavior called EventToCommand.  Details for the behavior:


As the post says, ‘EventToCommand is used to bind an event to an ICommand directly in XAML.”

This is WAY COOL!!!  EventToCommand helps overcome commanding challenges in Silverlight.

I love Blend Behaviors.  If you haven’t looked into them, YOU MUST!  Every WPF and Silverlight developer should be using them (where applicable).  “A Behavior is in essence a reusable piece of interactivity that can be applied directly to user interface elements…”

Here are some resources:

Good Overviewhttp://tinyurl.com/BehaviorsOverview

More readinghttp://tinyurl.com/BehaviorsTriggersActions

Expression Blend 3 SDKhttp://tinyurl.com/blend3sdk 

Lots of folks creating and uploading them to Expression Galleryhttp://tinyurl.com/BehaviorsGallery

Behaviors from the Blend Teamhttp://expressionblend.codeplex.com/

Behaviors are part of the Blend SDK.  There is a lot of confusion about the Blend SDK because people think you have to buy Blend to use it.  You don’t!  You can download it from http://tinyurl.com/blend3sdk and use it straight from Visual Studio.  Blend definitely makes wiring up Behaviors easier so you should it for that if you are already using Blend!

The samples you can download from http://expressionblend.codeplex.com/ include DataStateBehavior and DataStateSwitchBehavior.  Peter Blois has a good post on these behaviors:


DataStateBehavior/DataStateSwitchBehavior provide a nice clean way to change values in your ViewModel that result in initiating animations in your View.

I’ve been wanting to whip up a simple sample that shows both EventToCommand and DataStateBehavior/DataStateSwitchBehavior.  Unfortunately, I don’t have the time right now to do so.  Instead of sitting on this, I decided to blog about it first, then share a sample/video when I get around to it.

Surface Toolkit for Windows Touch

Robert Levy from the Surface team and Anson Tsao from the WPF team gave a great session on:

Multi-Touch on Microsoft Surface and Windows 7 for .NET Developers

The session is definitely worth watching if you are interested in building multi-touch apps on Windows 7.  In the session, they announced the Surface Toolkit for Windows Touch which is a set of “Controls, samples, templates, and docs Coming shortly after the WPF4 launch.”  Don’t let the Surface name fool you, the toolkit will work on any Windows 7 touch PC with the .NET Framework 4.0 installed.

This is exciting news that I have been keeping under wraps for quite some time.  The toolkit will take Windows 7 multi-touch developer productivity for WPF4 developers to the next level.  During the session, they shared that the toolkit will include:

Common controls optimized for Multi-Touch


Controls design primarily for Multi-Touch


Essential Multi-Touch UX Functionality


Hearing all of this is, of course, a bit of a tease since the controls won’t be available for a while, but exciting news nonetheless.  The good news is that the Surface team also announced that the Surface SDK is no longer “by invitation only.”  You can download it from http://surface.com/developer.  Since the toolkit is a subset of existing Surface 1.0 SDK assets ported to WPF4, you can get a head start by evaluating the Surface 1.0 SDK.  If your development cycle is far enough out, you might even want to consider building your app on the Surface 1.0 SDK and porting it to WPF4 / Windows 7 when the toolkit is available.  Of course, you will have to stick to the subset that is being ported to WPF4, but your code will only need minimal changes (if any) to run on a Windows 7 PC once the toolkit is released.

Hidden gems in the gaming starter kit

Yesterday I blogged about the SketchFlow starter kit and how great I thought it was.  Well, last night, I went ahead and tried the Venture into Gaming with Behaviors in Expression Blend 3 starter kit from:


Much to my surprise, this felt more like a Blend 3 Fundamentals through Building a Game.  To understand what I mean, here are the individual modules in the kit:

01_BLN03SP1EN720_Organizing_and Importing_Assets into_Expression_Blend










If you are looking to warm up to Blend a bit more through a video walkthrough + hands-on-lab kind of approach, then I’d definitely recommend this kit.  If you already understand these concepts, then you might want to skip this one.  On the other hand, it is kind of fun to see how easy it is to build a simple game with the skills you already have.

The biggest nugget for me was the module on Behaviors.  If you haven’t looked at Behaviors, then GO DO IT NOW.  Here’s a good post on behaviors:


“A Behavior is in essence a reusable piece of interactivity that can be applied directly to user interface elements in Expression Blend.”

I don’t remember where, but I saw someone describe Behaviors as "ASP.NET AJAX Control Extenders for Silverlight/WPF."  Not a bad way of describing them if you are familiar with the concept of ASP.NET AJAX Control Extenders.

Once you have wrapped your head around Behaviors, you’ll want to check out the following two links to download more:



In general, http://gallery.expression.microsoft.com is a great resource.  There are all sorts of useful things to download there including Art/Design assets, Web Templates, Samples, Themes, Behaviors, Code Snippets, Tools/Addins.

Prism Visual Studio Templates (including MVVM)

Prism is:

“The Composite Client Application Guidance is designed to help you more easily build modular Windows Presentation Foundation (WPF) and Silverlight client applications.”

What most people find, once they take the time to dig in to Prism, is that it is MUCH more.  Prism has guidance on how to build an app that targets both Silverlight & WPF, has some plumbing that makes MVVM easier in Silverlight apps by providing a basic commanding implementation, etc.  However, the learning curve to get proficient with Prism can be a turnoff for some.  Even once you “get it,” you then realize that there is a fair amount of Visual Studio solution/project setup just to get to the point of being able to start building your parts of the application.  The good news is that David Hill has just released some templates for Visual Studio 2008 to make the basic setup for your Prism based apps much easier:



I just went through the walkthrough in the first link.  Here is what you get after the “Prism Shell” and “Prism Module” templates:


You get the skeleton of a basic composite application using MVVM.  I think this is a big time saver.  I will definitely be keeping an eye out as David evolves the templates / quick start kit.

UPDATE: I was so excited to share my discovery of David’s work that I forgot to add a few more helpful resources I have found:

Code Snippet for Prism DelegateCommand

A code snippet to quickly write Prism commands

Integrating Virtual Earth 3D into WPF and Surface Applications for Mere Mortals

I just published a Channel 9 interview with Josh Wall and Josh Blake from InfoStrat about their Windows Presentation Foundation (WPF) and Surface controls that make integrating Virtual Earth 3D a breeze.  Check it out:


Virtual Earth 3D has many applications, but until recently has only been practical on the web with a JavaScript interface.  WPF applications could not use the full potential of Virtual Earth 3D without requiring a WPF wizard and some XAML magic due to Win32 interop limitations.

Information Strategies (InfoStrat) has the solution.  They created a WPF / Surface control, InfoStrat.VE, and are sharing with the community on CodePlex.  This control provides a WPF interface for the Virtual Earth 3D control, complete with data binding for camera control and WPF-based pushpins. All Win32 restrictions (air space control, no rotation or visual brush) are eliminated.  Microsoft Surface is also supported.

Watch the interview to learn the history behind the control, see it in action, learn how to get started, and even contribute back to the community.”

UPDATE: Interested in learning about a pretty cool solution that uses InfoStrat.VE? Check out Sam Chenaur’s post:

John L Scott Real Estate Looks to WPF and Software + Services

MVVM Toolkit for WPF

The Model View ViewModel pattern has become very popular for building WPF applications.  Until now, there wasn’t much guidance/tooling from Microsoft to help you get started with MVVM.  The WPF team just released an early preview of the MVVM Toolkit:

“The Model-View-ViewModel toolkit is intended to introduce the Model-View-ViewModel design pattern for building WPF applications to the broad WPF developer community.
The toolkit includes:

  • A Visual Studio 2008 template (Visual C# Express 2008 also supported)
  • Documentation
    • General introduction to M-V-VM
    • Walkthrough using the VS template
  • A complete WPF application demonstrating the M-V-VM pattern

You can download the toolkit on the WPF Futures page.”

I just installed it, went through the documentation/walkthrough.  I’d definitely recommend taking a look at this!

I hope there is something like this in the works for Silverlight:).

InfoStrat.VE – Intermediate fix published for the latest 3D control

digg_url = “http://blogs.msdn.com/devkeydet/archive/2009/04/21/infostrat-ve-intermediate-fix-published-for-the-latest-3d-control.aspx”;digg_title = “InfoStrat.VE – Intermediate fix published for the latest 3D control”;digg_bgcolor = “#555555”;digg_skin = “normal”;http://digg.com/tools/diggthis.jsdigg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;

Due to popular demand, InfoStrat just published an intermediate fix to get their InfoStrat.VE control working on top of the latest Virtual Earth 3D release.  You will notice that they just made a changeset available.  What they made available is not fully tested.  Once it is, they will publish a new release in the Downloads tab.  Here’s the post announcing the interim fix:


If you aren’t familiar with their control, then check out my blog post for a little background:


This control is a must have for any WPF or Surface developer looking to get Virtual Earth 3D working optimally in their app.

InfoStrat releases a Virtual Earth control for both WPF and Surface to CodePlex

digg_url = “http://blogs.msdn.com/devkeydet/archive/2009/03/10/infostrat-releases-a-virtual-earth-control-for-both-wpf-and-surface-to-codeplex.aspx”;digg_title = “InfoStrat releases a Virtual Earth control for both WPF and Surface to CodePlex”;digg_bgcolor = “#555555”;digg_skin = “normal”;http://digg.com/tools/diggthis.jsdigg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;

I’ve been waiting for this day to happen for a LONG TIME.  I’ve been working with WPF, Virtual Earth, and Surface for quite a while now.  If you’ve followed my blog, you’ve seen some hacked up samples showing various ways of getting Virtual Earth integrated into a WPF application.  I’ve been working with a number of customers and partners on Surface and WPF applications lately.  Just about every one of them wants mapping capabilities in their Surface and WPF apps.  That is not a surprise given that I focus on US Government customers. 

A while back, I created a fairly trivial sample of how to integrated Virtual Earth into a Surface app.  I’ve been sharing it as a starting point to get customers going.  I met Josh Wall from InfoStrat through my good friend Russ Williams from the Microsoft Technology Center in Reston, Va.  Russ and I had worked together on a few Surface opportunities.  He told me about a conversation he had with Josh from InfoStrat.  Josh was interested in the sample that I put together.  We had a call to discuss some of the challenges around Virtual Earth / Surface integration and we shared the sample with Josh. 

What happened next still amazes me.  InfoStrat took the sample, completely rewrote it using a much better technical approach, and started building their own reusable VE WPF/Surface control.  After seeing the amazing work that InfoStrat put into their control, I figured I would ask them if they would be willing to put it on CodePlex.  Much to my surprise, they were very interested in the idea.  They came up with a plan, and the end result is that today they have announced the first release of the control on CodePlex.

What does this mean to you?  If you are a WPF or Surface developer looking to integrate Virtual Earth into your applications, then InfoStrat just saved you a heck of a lot of time and technical challenges.  The fact that InfoStrat was willing to share their work with the community still blows my mind.

I’ll be doing a Channel 9 Inside Out interview with InfoStrat about the control soon.  Stay tuned!

Here’s a description of the CodePlex project:

Project Summary

This control provides a WPF interface for the Virtual Earth 3D control, complete with data binding for camera control and WPF-based pushpins. All Win32 restrictions (air space control, no rotation or visual brush) are eliminated. Microsoft Surface is also supported.

Project Details

Virtual Earth 3D has many applications, but until recently has only been practical on the web with a javascript interface. WPF applications could not use it to its full potential without requiring a WPF wizard and some XAML magic due to Win32 interop limitations.

The solution is here: InfoStrat.VE

Created by InfoStrat, this project provides a VEMap control for WPF and SurfaceVEMap control for Microsoft Surface. SurfaceVEMap derives from VEMap and adds multi-touch manipulation support.

For examples of Microsoft Surface solutions we’ve built with this control go to our InfoStrat Surface gallery.

InfoStrat.VE allows WPF and Microsoft Surface developers to take full advantage of Virtual Earth 3D with minimal overhead. Simply reference the dll, add a single VEMap control to your XAML, and you have a map! The control eliminates the Win32 Interop restrictions, so you can do everything with this VE control that you could do with any native WPF control, including:

  • Overlay items (no more transparent windows!)
  • Rotate and transform the map within the interface (no more boring rectangles, bring on the 360 degree interfaces!)
  • Use the map within a Visual Brush (you know you want faded reflections!)

Josh Blake, the primary developer on the project, announced the publishing of the control here:


What are you waiting for?  Head over to the CodePlex page to learn more:


About InfoStrat:

Information Strategies ("InfoStrat") helps customers solve complex business problems with IT Consulting Services such as: Requirements Analysis, Software Architecture and Design, and Application Development Services.  InfoStrat is an award-winning Microsoft Gold Certified Partner with Gold Certifications in eight Microsoft Competency Solutions Areas.

Founded in 1987, InfoStrat is one of the nation’s foremost leaders in IT Services focused on Microsoft technologies.  InfoStrat has provided IT Consulting Services on over 1000 customer projects.  InfoStrat consultants hold over 150 Microsoft technical certifications and are experts in .NET application development focused primarily on:

News release about CodePlex project on infostrat.com:


InfoStrat’s Single View Platform landing page:


PARTNER SHOWCASE: Northrop Grumman – Innovating for the War Fighter with Microsoft Surface

digg_url = “http://blogs.msdn.com/devkeydet/archive/2009/03/04/partner-showcase-northrop-grumman-innovating-for-the-war-fighter-with-microsoft-surface.aspx”;digg_title = “PARTNER SHOWCASE: Northrop Grumman – Innovating for the War Fighter with Microsoft Surface”;digg_bgcolor = “#555555”;digg_skin = “normal”;http://digg.com/tools/diggthis.jsdigg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;

I’ve been a Developer Evangelist for 3+ years now.  For the first 3 years, I spent the majority of my time focusing on delivering public presentations at conferences, for webcasts/screencasts, onsite at customer facilities, and at local community events in DC area.  This year, the focus of my role changed slightly.  Although I still do my fair share of the previously mentioned activities, I am now on a team that focuses on Systems Integrators (SIs) and Partners who do work for the US Government.  I’ve always been focused on US Government developers, but the scope of the people I interacted with was more broad.  With my new role, I have had more of an opportunity to work with SIs and Partners on things like Proof of Concept (POC) applications. 

Back in September/October, I had the pleasure of spending a few weeks with Northrop Grumman and the Microsoft Technology Center in Reston, Virginia to build a POC application on Microsoft Surface.  After the completion of the POC, we recorded an interview and demo with the team responsible for creating the application.  I just published that video.  Here’s the description:

“Northrop Grumman partnered with the Microsoft Technology Center and the Microsoft US Public Sector Developer and Platform Evangelism team to build a Proof Of Concept (POC) application that would demonstrate how Microsoft Surface could enhance mission planning, rehearsal, and post mission knowledge collection for military command and control decision making.  Northrop Grumman Corporation is a leading global security company whose 120,000 employees provide innovative systems, products, and solutions in aerospace, electronics, information systems, shipbuilding and technical services to government and commercial customers worldwide.

Watch the interview to see a full demo of the POC.  The interview highlights Northrop Grumman’s learning experiences on the POC especially with regard to Windows Presentation Foundation (WPF), the Surface SDK, the designer/developer workflow enabled by WPF and the new thinking behind Natural User Interfaces with an emphasis on User experience.”

The interview is available at:


One of the things I am trying to do in my new role is to start a “PARTNER SHOWCASE” series of posts to help highlight work like this that SIs and Partners are doing for US Government customers.  Feel free to contact me if you fall into this category and you’re interested in showcasing your work on Channel 9!