The 6th drop for this project is already out of the team room and into Codeplex, as it has been every 2 weeks since 2*(6-1)=10 weeks back from today.

You can see the complete list of latest changes in Erwin’s post.

 

The biggest changes for this drop, although not very noticeable from the outside if you’re just using the default way that Regions work without the need to extend them, are:

  • Added RegionContext

This is to provide a way to pass some context to the Views that are placed inside a particular instance of a region. You were usually able to workaround the need for this context by using EventAggregator or scoped DI containers, but luckily this will be easier to achieve for those same scenarios and for more complex ones (for example when using scoped region managers and having several instances of the same region).

  • Formalized infrastructure for extending the behavior of Regions

In Prism 1.0 there were already some ad-hoc behavior classes for extending the functionality of the regions (for example the CollectionActiveAwareBehavior or SelectorRegionSyncBehavior).

In Prism V2, we also had to rethink how the RegionManager attached properties would work in the Silverlight world, as it is different from WPF (Silverlight lacks property value inheritance). We also added features like the new Pull-based composition scenario, or the RegionContext attached property.

We started adding separate behavioral objects for these new features, which were very flexible, but very hard to understand, debug, and to know which objects were currently modifying the behavior of a particular region instance.

This created the need for an infrastructure for all of these formerly independent behavior objects, that would make the library easier to understand, extend and maintain.

The IRegion interface now has a collection of IRegionBehavior objects, so you can always know which objects are extending the functionality of a particular Region instance, and it can also couple the lifetime for these behaviors and regions, in order to prevent memory leaks when developing new behaviors.

    RegionBehaviors infrastructure in Prism V2Picture taken from Erwin’s blog post. Read the full post here
  • http://wizardsofsmart.net/author/riles/ Ryan Riley

    This is great stuff. Any chance we’ll see a PresentationModel DataTemplate View example in Silverlight soon?

  • jdominguez

    I’m glad you like it.
    I don’t have “ViewModels and DataTemplates in Silverlight” in my current blog post backlog, and here’s why:

    Even though I really like Model-View-ViewModel using DataTemplates in WPF, I believe that at this point with Silverlight it will be very hard to achieve.
    The reason is not just because the DataType property that hooks up the template automatically does not work (even though using Silverlight Toolkit may help you workaround this in some situations), but also the binding capabilities are not enough to have zero code behind. You’ll find yourself creating extremely complex XAML and ViewModels in order to bind them correctly, which beats the purpose of simplicity in the view.
    Nevertheless, I think there is still value in using MVVM, but having the View be a UserControl instead of a template, and workaround some of the WPF and Silverlight differences with little code-behind.

    What are your thoughts? Are you using DataTemplates as views in any projects currently?

  • http://michaelsync.net Michael Sync

    Great!!