IActiveAware and nested regions

Topics: Prism v2 - Silverlight 3, Prism v2 - WPF 3.5
Feb 23, 2010 at 1:35 PM


I have 2 questions concerning IActiveAware and nested regions. I'm using SL 3, but I think the situation is the same for WPF.

  1. The RegionActiveAwareBehavior isn't checking the Region.ActiveViews property in its Attach method, and I wonder why?  When calling RegisterViewWithRegion for a region that does not exist yet (because it's a nested region that will be created later), the AutoPopulateRegionBehavior will fill the ActiveViews list BEFORE the RegionActiveAwareBehavior gets attached (assuming the default configuration). So the RegionActiveAwareBehavior.OnCollectionChanged event will not fire, and the Active property will not be set to true on views that are created this way. If the view should get removed from its region, Active=false will be set correctly, so it's only the initialization that gets wrong.
  2. Suppose I'm adding a view to a region A, and this view defines a region B. When I add a view to B, Active=true is set correctly on this view. However, if I remove the view that defines B from A, than Active=false is set only on that view, but not on the view(s) in B. I would expect that removing a view and thereby its inner regions (and B is apparenty removed completely, since it is possible to add it again without the region manager complaining that it already exists) implies deactivating all the views in the nested regions. Am I doing something wrong, or could there be a bug?



May 20, 2011 at 1:40 AM


I've got the same issue as described in question 2. I would expect that all views in inner regions will get IsActive equals False if parent view is removed from the visual tree. Is there any ways to work-around this issue? Do I need to do this manually?


May 20, 2011 at 7:04 PM
Edited May 20, 2011 at 7:04 PM

Hi Matthias,

You might find the following work items useful, where these subjects are treated:

I hope you find this helpful.

Guido Leandro Maliandi