Note that there are some explanatory texts on larger screens.

plurals
  1. POPrism v4/MVVM (Unity/WPF) - Load Modules into the same Region
    primarykey
    data
    text
    <p>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.</p> <p>This is an example of the Shell design</p> <pre><code> &lt;StackPanel Orientation="Vertical" Grid.Column="0" Grid.Row="1"&gt; &lt;Button Content="Home" Height="23" Name="Home" Width="75"/&gt; &lt;Button Content="Users" Height="23" Name="Users" Width="75"/&gt; &lt;/StackPanel&gt; &lt;Border Grid.Column="1" Grid.Row="1" Background="WhiteSmoke"&gt; &lt;ContentControl cal:RegionManager.RegionName="MainRegion" Name="MainRegion"/&gt; &lt;/Border&gt; </code></pre> <p>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.</p> <p>This is an example of how is added the modules in my Bootstraper:</p> <pre><code> 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 }); } </code></pre> <p>This is the Initialize method of the modules:</p> <pre><code> public void Initialize() { this.container.RegisterType&lt;IUserController, UserController&gt;(new ContainerControlledLifetimeManager()); this.regionManager.RegisterViewWithRegion("MainRegion", typeof(Views.UserSummaryView)); } </code></pre> <p>And finallly this is how the module is called from the menu.</p> <pre><code> private void User_Click(object sender, RoutedEventArgs e) { moduleManager.LoadModule("UserModule"); } </code></pre> <p>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</p> <p>Thanks for your help</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload