Freigeben über


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.

Commanding

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:

image  

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. 

image

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:     ;
    7:     

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

Comments

  • Anonymous
    December 09, 2008
    PingBack from http://www.alvinashcraft.com/2008/12/09/dew-drop-december-9-2008/
  • Anonymous
    December 10, 2008
    Hi,We are seriously considering using Prism for a Silverlight Application that we are about to build.However, we have to wait until the the stable version of Prism V2 is released before we use it.Do you have a roadmap on when you will release the stable version of Prism?Thanks and Prism is excellent!\Paulo
  • Anonymous
    December 20, 2008
    Paulo,We planning on releasing by mid-February 2009.  The functionality of the library that we are going to provide is there so you should get a good idea of what will be available.Some of the next things that we're going to tackle include changing the UI to a new design, cleaning up the API a bit for consumability, and flushing out the documentation.-b