Behaviour of SingleActiveRegion

Topics: Prism v2 - Silverlight 2
Jun 25, 2009 at 3:19 PM

I am trying to inject views in to a region that is a TransitioningContentControl from the Silverlight Toolkit and there is a problem with the way in which SingleActiveRegion would work with TransitioningContentControl.

The SingleActiveRegion will cause a change in the content from current view to null and then null to new view because it first deactivates the current view and then activates the new view.  I think this means that I can't get a smooth transition from current view to new view.

However if SingleActiveRegion found the current view, then activated the new one, before deactivating the former current view then it would work, because ContentControlRegionAdapter uses FirstOrDefault() to find the active view.  Whether the new view comes before the current view in the collection or not there would only be one change to the content of the content control.

I could fix this by creating a region adapter for TransitioningContentControl that returns something similar to SingleActiveRegion from CreateRegion(), however it might be worth considering changing the behaviour of SingleActiveRegion.

Jun 25, 2009 at 7:40 PM

Hi

 

Although I have not used the TransitioningContentControl  to transition between views, you are right when you say that there is a moment when the ContentControl content is null. If for some reason you require the view to always have content, you can inherit from the SingleActiveRegion and override its Activate method (you will find that Prism-v2 was built to be easily extended).

 

Of course, if you want this TransitionSingleActiveRegion to adapt only controls of type TranstioningContentControl, you will have to register the required region behaviors and adapter mappings.

You can get more information about this in the following articles from the Prism-v2 documentation:

·         How to: Create a Custom Region Adapter

·         UI Composition

 

If you believe your suggestion could be useful for the community, you can create a new item in the Prism-v2 Issue Tracker so people can vote for it. Perhaps it might be taken into account for a future version.

 

Please let me know if this helps.

 

Damian Schenkelman

http://blogs.southworks.net/dschenkelman

Jul 2, 2011 at 3:44 PM

Rich, did you ever do this?  If so, I'd like to talk to you about it.  RANGERD@MICROSOFT.com

 

Jul 4, 2011 at 3:56 PM

Damian,

 

This is the post to which I was referring.

 

range