I'm working in a project where I have declared two sections in the Shell; one of these is used to place a menu whose items will load modules on demand and the another one will be used to load the Views of the requested modules.
This is an example of the Shell design
<StackPanel Orientation="Vertical" Grid.Column="0" Grid.Row="1">
<Button Content="Home" Height="23" Name="Home" Width="75"/>
<Button Content="Users" Height="23" Name="Users" Width="75"/>
</StackPanel>
<Border Grid.Column="1" Grid.Row="1" Background="WhiteSmoke">
<ContentControl cal:RegionManager.RegionName="MainRegion" Name="MainRegion"/>
</Border>
As you can see the "Menu" is composed by button series (this is only for test) and a ContentControl that works like a Region where I need to load the Views.
This is an example of how is added the modules in my Bootstraper:
protected override void ConfigureModuleCatalog()
{
base.ConfigureModuleCatalog();
System.Type homeModule = typeof(FieldCollection.Home.HomeModule);
ModuleCatalog moduleCatalog = (ModuleCatalog)this.ModuleCatalog;
moduleCatalog.AddModule(new ModuleInfo() { ModuleName = homeModule.Name, ModuleType = homeModule.AssemblyQualifiedName, InitializationMode = InitializationMode.OnDemand });
System.Type userModule = typeof(FieldCollection.User.UserModule);
moduleCatalog.AddModule(new ModuleInfo() { ModuleName = userModule.Name, ModuleType = userModule.AssemblyQualifiedName, InitializationMode = InitializationMode.OnDemand });
}
This is the Initialize method of the modules:
public void Initialize()
{
this.container.RegisterType<IUserController, UserController>(new ContainerControlledLifetimeManager());
this.regionManager.RegisterViewWithRegion("MainRegion", typeof(Views.UserSummaryView));
}
And finallly this is how the module is called from the menu.
private void User_Click(object sender, RoutedEventArgs e)
{
moduleManager.LoadModule("UserModule");
}
The problem is that only the first view called is displayed in the region. I'm using Prism 4 and Unity like Dependency Injection container
Thanks for your help