This project is read-only.


Default Region Behavior Order Problem


User tyoung in this thread(
The UnityBootstrapper ConfigureDefaultRegionBehaviors() method currently adds the AutoPopulateRegionBehavior as the first default behavior in the defaultRegionBehaviorTypesDictionary.
For a Silverlight application using View Discovery, attaching the AutoPopulateRegionBehavior to a region before the other default behaviors can cause the views registered against the region to be created and added to the region before other default behaviors are attached to the region. This can result in an ActiveAware view not being informed it is active since the ActiveAware behaviour hasn’t been attached to the region at the point where the view is created and added to the region.
Changing the code to add the RegionActiveAwareBehavior ahead of the AutoPopulateRegionBehavior fixes the problem described.
I haven't looked into how the other behaviors interact so I'm interested in the reason for the current order and any known problems that could be created by changing the order.
Closed May 1, 2014 at 7:27 PM by blainew
Addressed in Prism 5.0


GuidoMaliandi wrote Apr 6, 2011 at 6:35 PM


For those concerned with this issue, it could be helpful to know that, in both the UnityBootstrapper and MefBootstrapper the ConfigureDefaultRegionBehaviors method is called before the CreateShell, InitializeShell and InitializeModules methods, so the aforementioned timing issue shouldn't cause problems, as no Regions should be created when there are no modules nor shell yet loaded.

If you find a scenario in which this is troublesome, it would be helpful if you could provide us with more information regarding it, or possibly a sample application portraying the issue.


Guido Leandro Maliandi

GuidoMaliandi wrote May 20, 2011 at 8:04 PM


We've found and verified a scenario in which this is causing an undesired behavior. You can find more information about this in the following thread:

aadami wrote Dec 6, 2011 at 7:02 PM


I modified the prism library to see if changing the order of the ConfigureDefaultRegionBehaviors method in the Bootstrapper class would cause any problem. Therefore, I changed the code to add the AutoPopulateRegionBehavior at the end of the method.

So far I ran the following tests and they seem to work fine:

*Prism Library Desktop tests
*Prism Library Silverlight tests
*Smoke tested RI Stocktrader
*Smoke tested RI MVVM

On the other hand, if you need to change this order without modifying the prism library you could try overriding the ConfigureDefaultRegionBehaviors method in your Bootstrapper, like in the following code snippet:

protected virtual IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
        var defaultRegionBehaviorTypesDictionary = ServiceLocator.Current.GetInstance();

        if (defaultRegionBehaviorTypesDictionary != null)








        return defaultRegionBehaviorTypesDictionary;

Agustin Adami