How to make an object singleton for some OnDemand modules?

Topics: Prism v4 - Silverlight 4
Jul 22, 2011 at 10:06 AM


I have a prism application in which there is a main module which loads first and sets the region behavior(as autopopulate).

Other modules are OnDemand. When each module loads a new instance of Autopopulatebehavior(and other globally registered classes) is created.

So when a new region is added RegionCreationException is thrown because the GetInstance method throws a Sequence contains more than one element on

Autopopulatebehavior class. Is there any way to make such classes singleton for ondemand modules?


thanks in advance

Jul 22, 2011 at 2:10 PM
Edited Jul 22, 2011 at 2:15 PM


Region behaviors are behaviors that apply globally to regions; therefore, you should register them in your bootstrapper, by overriding the ConfigureDefaultRegionBehaviors method.

You can read more about region behaviors in this section of the UI Composition chapter in the Prism MSDN documentation.

If you experience the same problem after applying the aforementioned situation, it would be helpful if you could provide us with a repro sample, so that we can help you further with this.

I hope you find this helpful.

Guido Leandro Maliandi