Prism V2 Drop 7 Now Available

The latest drop of Composite Application Guidance for WPF and Silverlight (Drop 7) is now available on CodePlex.  You can get it here.  I’ll talk about a few of the changes here.


Prism drop 7 contains the first scenarios for Commanding.  The challenge here is that, in Silverlight, there is no command binding.  In the the first version of Prism, we used the existing command binding infrastructure and provided a DelegateCommand to connect ViewModel methods to a command, and CompositeCommand to coordinate activity across multiple ICommands.  It turns out that the ICommand interface is available in Silverlight 2, so the latest drop introduces a Command.Click attached property and ClickCommandBehavior that connects any ButtonBase’s click event to an ICommand (such as DelegateCommand).

The behavior also monitors changes to the ICommand’s CanExecute state and will set the button’s IsEnabled property appropriately.  The basic relationship between the button, behavior and command looks like this:


There is much more that can be done with behaviors, I recommend you check out Nikhil’s blog post on behaviors and Julian’s post on some of the initial work we did around this.

With the attached property, setting up the behavior looks very similar to how commanding work in WPF. 

WPF Version

 <Button Content="Save" 
         Command="{Binding SaveOrderCommand}"></Button>

Silverlight Version

 <Button Content="Save" 
         cal:Command.Click="{Binding Path=SaveOrderCommand}" />

Check out the Command Quickstart in the latest drop to dive into this more.

Modularity Changes

We’ve tried to simplify some of the modularity concepts we’ve previously introduced while working on the Directory Lookup and Configuration Based modularity.  One of the changes we made was to change ModuleCatalog to allow either placing modules into groups or right to the catalog. 


This is particularly useful when you have static module references and you have no need for explicit groups:

    1: ModuleCatalog catalog = new ModuleCatalog();
    2: catalog.AddModule(typeof (ModuleA), "ModuleD")
    3:     .AddModule(typeof (ModuleB))
    4:     .AddModule(typeof (ModuleD), "ModuleB")
    5:     .AddModule(typeof (ModuleC), InitializationMode.OnDemand)
    6:     ;

Another change from previous versions is how catalog validation and dependencies are solved/resolved.  Previously, the ModuleManager had the responsibility for these aspects, this has now been moved to the ModuleCatalog.  This allows different catalogs to be used that may have different approaches to viewing validation or dependency resolution.  The ModuleManager can ask a ModuleCatalog for dependent modules.

What’s Next?

  • Finishing the Silverlight version of the RI

    • Watchlist
    • Buy/Sell
    • News
  • Re-skinning the UI at least for Silverlight