Creating Silverlight Composite Application using Prism – Screencasts

image updated

  1. An Intro to Composite Applications – Eric Mork

    Prism can be thought of as a set of libraries that help Silverlight applications be scalable and testable. It has a number of features (modularity, view regions and commanding) that help with this. This guide shows you how to get started writing a Prism application in Silverlight. It shows how to use the bootstrappers, modules, catalogs, regions and commanding.

  2. How Commanding Works in Prism and MVVM– Eric Mork

    Prism Commanding allows designers/develops to specify, in XAML, events that fire back into the View Model/Presenter. Imagine this: the user hovers a mouse over a Silverlight control. Commanding allows that action to be bound to a method (more specifically, a delegate) in the ViewModel. The View Model then handles that action. This Commanding support overcomes a deficiency (lack of ICommand implementation) in Silverlight that makes proper MVVM implementation difficult. If you’re using MVVM, Commanding is a must. That can take the form of a home-grown solution, Prism or any of a number of other libraries: Caliburn, Silverlight.FX, etc. In Prism Commanding, the Commands are implemented as attached properties. This video shows how to use the existing command (button click), handle command parameters, use the CanExecute functionality, and create new commands.

  3. Eventing in Prism – Loosely Coupled Talking – Eric MorkPrism allows us to have modular and loosely coupled applications, but how do these loosely coupled pieces communicate? That’s where Eventing and the EventAggregator come in: they provide communication channels. A way that the separate pieces of the application can safely talk back and forth. Eventing also has extra goodies (thread preference, weak references) that are built on the lessons learned from past technologies (like CAB). All around, it’s a great helper for any Silverlight/Prism (or WPF) application.
  4. Modularity – Testing, Module Catalog and Unity in Prism – Eric Mork

    Modularity allows applications to be broken down into discrete pieces. This allows for easier testing, better maintainability and the ability to distribute an application across multiple teams. This video explores the modularity support in Prism. The first part of the video covers Unity and Unit Testing. Inversion of Control using Dependency Injection and Service Location are both covered. The second part of the video details modules and how they’re loaded by the Module Catalog.

  5. Regions in Prism Video – Eric Mork

    Regions in Prism are kind of like Master Pages. They allow us to have master and sub-views. If you’re interested in composing views separately and then bringing them together in the running application, Regions are for you. As with all of the things in Prism, Regions are a part of the buffet. You can use them or not at your discretion.


In this 4 part series, Bob Brumfield and Erwin van der Valk from patterns and practices shows you how to build a modular application using the recently released Composite Application Guidance for WPF and Silverlight – February 2009 (also known as Prism V2). Source code.

  1. Creating a shell and modules

  2. In this screencast, you will see how to divide an application into modular pieces and how to recombine them again in a shell.

  3. Visual Composition

  4. This webcast demonstrates how to create placeholders for views and how to load views into them.

  5. Implementing views and services

  6. This webcast demonstrates how to create a view using the Model – View – ViewModel pattern, and how to create and inject Services into your classes by using the Unity Dependency Injection Container.

  7. Decoupled Communication

  8. This webcast demonstrates how to communicate between the different modules.

    Click the links above to watch the screencast.

    Also, from Prism Codeplex – Learn about Prism through videos and blogs Learn Prism

TriggerAction driven command execution with zero code behind


The new Behavior-based trigger system (which works in Silverlight and WPF) opens the door for custom Trigger Actions. Now that we have custom Trigger Actions, we will be able to create an ExecuteCommandAction that allows you to invoke a Command from any trigger.

What’ll we be doing is creating an ExecuteCommandAction that we can trigger using any Blend trigger, this action will be bound to a ICommand exposed by the ViewModel.

In the current version of Silverlight standard behaviors don’t support Binding, there is a work around discussed earlier on this blog by PeteBlois using BindingListeners and exposing Bindings rather than ICommand.

public class ExecuteCommandAction : TriggerAction<FrameworkElement>


private readonly BindingListener commandListener;

private readonly BindingListener commandParameterListener;


And here –>

View-First(Xaml) vs ViewModel-First(DI via constructor)


How do you create Views and ViewModels.  The two approaches I hear most often are:

  • View-First: The View has a relationship to its ViewModel(usually through data binding).
  • ViewModel-First: The ViewModel creates the view (usually through an IoC container).

In View-First, it is usually is exemplified in XAML like so:

<UserControl x:Class="MVVM.Client.Views.GameView"
    <data:GamesViewModel x:Key="TheViewModel" />
  <Grid DataContext="{Binding Path=Games, Source={StaticResource TheViewModel}}">

In ViewModel-First, it is usually implemented using a Inversion of Control container (e.g. Unity, Ninject, Spring, etc.). This way the ViewModel can request the interface (in the constructor) for the View it expects:

public MyViewModel
  public MyViewModel(IMyView view)

In both of these methods it presents a sticky-ness of the view to the view-model. Also, both of these imply a one-to-one relationship which while the common case, is not the always case.

Shaw Wildermuth has come up with another pattern called  “Marriage”.

public interface IView
  void ApplyViewModel(object viewModel);

IView view = theContainer.Resolve<IGameView>();
IViewModel vm = theContainer.Resolve<IGameViewModel>();

Read more -> Shawn Wildermuth – Which came first, the View or the Model?

MVVM with Prism 101 – Mark Miller



A series of articles about implementing the Model-View-View-Model (MVVM) architectural pattern for Silverlight/WPF. MVVM in itself is not a complex pattern, however having a framework can reduce the work required to accomplish more advanced scenarios. For example, communicating between modules in a loosely coupled way requires some sort of event framework. Prism provides this.

You may also interested in –>  Prism for Silverlight 2: Taking ‘Hello World’ to a Whole New Level

  • WCF integration
  • Design-time data binding
  • Independent, decoupled modules
  • Commanding support

MVC, MVP, MVVM Design Patterns


1. The 1st half of this article will compare and contrast MVC, MVP, and MVVM, and suggest which pattern to use based on your technology of choice and the problem that you are trying to solve. The 2nd half will be an overview about how MVVM could be used in Silverlight.



Read more here -> CodeProject: Model View Controller, Model View Presenter, and Model View ViewModel Design Patterns. Free source code and programming help

2. Model-View-ViewModel (better known by its super hero alias of MVVM ) is a great pattern to use with Silverlight and WPF. Here is a 5 minute perspective on MVVM.


1 reason MVVM works really well with XAML based applications is because of the powerful XAML binding features. This allows the View (the presentation of to the user) to be separated from the data and the logic. The View can be designed in Expression Blend while the ViewModel can be developed in Visual Studio .NET. It allows for the presentation to be separated very easily. This is just 1 reason, albeit a powerful one.


Read more here –>

MVVM Light Toolkit for Silverlight


To make development of WPF and Silverlight applications according to the Model-View-ViewModel pattern easier, here is a small toolkit which should speed up the creation of such applications by automating certain tasks.

Via MVVM light toolkit (Silverlight edition) posted




Silverlight.FX is a light-weight application framework for building Rich Internet Applications with Silverlight 2.


Here is a list of the current feature areas in Silverlight.FX:

  • Application Model – SilverlightFX features a richer Application object providing a service model, an IoC container, support for theming, view model (M-V-VM), navigation and MVC, amongst various other features.
  • User Interface Components – SilverlightFX provides a small set of enhanced controls, support for Forms and Windows, master page like containers, layout controls and data-bound controls.
  • Declarative Views – SilverlightFX provides a framework for writing behaviors, actions, triggers, and commands, and also provides a set of out-of-the-box implementations.
  • Effects and Transitions – SilverlightFX provides a procedural animation framework capable of implementing tweens and interpolations and easing behaviors. Additionally it provides simple but broadly applicable animations that can be applied as effects and transitions to standard controls in a fully declarative manner.

Via Silverlight.FX