views:

14

answers:

1

I am using Prism (Composite Application Framework) to build an application. I have my shell created and it has three regions( Main, menu, switchboard). I would like to load my switchboard region in the shell with a switchboard user control but in this case, I don't want to load it through a module.

So, how do I register my view (switchboard user control) with my shell's switchboard region inside of the boot strapper. Maybe it is only possible to create a module specifically for the switchboard user control but it seems like a waste of time. I've been trying to attempt this but ultimately can't seem to get access to the RegionManager through my derived UnityBootStrapper class.

Thank You.

A: 

Hi Brian,

Wihtout knowing your entire scenario, it might not be necessary to add the Switchboard UserControl to a region. This is because, if your scenario requires you to add it in the Shell project, you might not need the extensibility and UI Composition capabilities provided by regions.

Assuming the SwitchBoard using control is in a ContentControl you could simply place it there from inside the Shell designer, without the need to define a region. On the other hand, if the SwitchBoard user control is placed inside a Selector or ItemsControl you could define the region, and add it as one of its children. You will still be able to add new views to those regions, and the SwitchBoard control will always be in the Shell.

That said, assuming the RegionManager has been registered in the container, you can do something like this to access the RM in the bootstrapper: (pesudo code):

public class MyBootstrapper : UnityBootstrapper
{
    MyMethod()
    {
        IRegionManager manager = this.Container.Resolve<IRegionManager>();
    }
}

I hope this helps.

Thanks, Damian

Damian Schenkelman

related questions