Handling Region Manager for Multiple Region with same name

Topics: Prism v2 - Silverlight 3
Dec 1, 2009 at 4:09 PM

Hi,

I am currently working on an Application using CAG with Silverlight on MVVM Pattern, In this we created Shell with Multiple Regions say "Top", "Left", "Right", after loading regions with View

we are opening a Popup which in turn contains 2 more Region as "Top" and "Right", Here i am getting a debugger error might be because i need to properly handle my Region Manager for

Multiple Region with same name.

Can anybody help me out to handle my Region Manager. Let me know if further clarification needed.

 

Dec 1, 2009 at 6:52 PM

Hi

Based on your description and without knowing the specific error you are getting, it appears that your issue could be related, as you said, to having multiple regions with the same name registered in the RegionManager. The exception that is thrown in this kind of situations is: “An exception occurred while creating a region with name '%RegionName%'. The exception was: System.ArgumentException: Region with the given name is already registered: %RegionName%.”

The simple workaround would be changing the name of one of the regions that share the same name. Another workaround involves using a scoped RegionManager. This will allow you to have the same name for regions in different RegionManagers.

You can read about scoped RegionManagers in this article from the Prism documentation:

Please let me know if this helps.

Damian Schenkelman
http://blogs.southworks.net/dschenkelman