Blendability in PRISM v4

Topics: Prism v4 - Silverlight 4
Dec 6, 2010 at 10:34 AM
Edited Dec 6, 2010 at 10:35 AM

One of the early promises made for PRISM v4 is that Blendability would be a key topic area covered in the documentation and quickstarts.

Maybe I'm missing something but a search on Blendability reveals just two hits: one in Basic MVVM QuickStart which states "If you do that, make sure you do so in a way that will not break the designer.  For more information about how to do that, see Blendability." The word Blendability is highlighted in a different color in the pdf as if it should be a hyperlink, but it isn't.  Can anyone point to me where this "Blendability" section is, or did it just get missed out?

The other hit on a search for "Blendability" is "Chapter 7: Composing the User Interface" but again there are just some vague references to using Blend rather than specific code examples showing how to achieve this when using Unity for dependency injection (when suddenly a constructor with parameters needs to be called, precluding use of the traditional declarative XAML approach for hooking up the View to the ViewModel).

The overly simplistic "MVVM Reference Implementation" doesn't help much either because it's not doing the sorts of things I would expect a real reference application to do (eg event aggregation injection with Unity). I want a reference implementation to include examples of all the PRISM functionality rather than a very small subset of the PRISM functionality (the Stock Reference Implementation does a much better job of this, but relies on the MEF approach rather than the Unity one and doesn't really serve as a good MVVM reference application). The QuickStarts concentrate on individual areas but again there's no real example of bringing everything together.

For now I'm using code behind in the View to specify the ViewModel as a Unity [Dependency] object:

public MyModuleViewModel MyModuleViewModel
   get { return DataContext as MyModuleViewModel; }
   set {DataContext = value; }

This is not as "clean" as the declarative approach (such as that used by MVVM Light's ViewModelLocator class and resource specification) Is this a good way to achieve what is required, or are there better ways?  Links to good blog posts on this subject would be appreciated.


Dec 6, 2010 at 7:33 PM


The section of the documentation that provides guidance on blendability is in this chapter, under the title "Guidelines for Creating Designer Friendly Views". You might also find this thread useful to your purpose.

I hope you find this helpful.

Guido Leandro Maliandi