Multiple shell window

Jul 16, 2008 at 2:24 PM
My application needs to open several Windows. But in all the samples, there is only one shell with one RegionManager!

So I understand I need to create several shells (System.Windows.Window) with 'cal:RegionManager.RegionName="MyRegion"' into their XAML file.
And in order to show a second shell window, and to make the region manager work, I do the following:

Window2 shell2 = new Window2();
RegionManager.SetRegionManager(shell2, container.Resolve<IRegionManager>());

I use the same RegionManager for all the shells!
It seems to work with that piece of code but I wonder if it is the right way to get several shells windows!
May be it could be better to create one RegionManager per shell window, but how?

Jul 16, 2008 at 4:48 PM
I think the way you solved the problem having multiple shell windows is great. As long as the region names from one shell window don't have the same name as regions in the other shell window you should be fine.
Jul 16, 2008 at 5:03 PM
if you want to use the same region name(s) for multiple shells, you can do something likes

IRegionManager newRegionManager = container.Resolve<IRegionManager>().CreateRegionManager();
RegionManager.SetRegionManager(shell2, newRegionManager);
Jul 18, 2008 at 1:51 PM
Thank you for yours answers and for the "CreateRegionManager()".