Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF Prism Region Manager Issue

$
0
0

Hi,

I am trying to learn WPF with Prism and using Modern UI Template. I have Problem with region Manager, unable to find the region in collections but the views are getting injected properly.

Here is what i am doing 

Step A : Shell Window

<mui:ModernWindow x:Class="SimpleAccounting.Shell"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mui="http://firstfloorsoftware.com/ModernUI"
        xmlns:prism="http://www.codeplex.com/prism"
        ContentSource="/PlaceHolders/AccountModulePlaceHolders/AccountListPlaceHolder.xaml"><mui:ModernWindow.MenuLinkGroups><mui:LinkGroup DisplayName="Accounts"><mui:LinkGroup.Links><mui:Link DisplayName="New Account" Source="/PlaceHolders/AccountModulePlaceHolders/NewAccountPlaceHolder.xaml"></mui:Link><mui:Link DisplayName="Available Accounts" Source="/PlaceHolders/AccountModulePlaceHolders/AccountListPlaceHolder.xaml" /></mui:LinkGroup.Links></mui:LinkGroup></mui:ModernWindow.MenuLinkGroups></mui:ModernWindow>


Step 2 : Page Source or Region Definitions

<UserControl x:Class="SimpleAccounting.PlaceHolders.AccountModulePlaceHolders.AccountListPlaceHolder"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             xmlns:prism="http://www.codeplex.com/prism"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"><ContentControl Name="NameAccountListPlaceHoldersRegion" prism:RegionManager.RegionName="AccountListPlaceHoldersRegion" Grid.Row="0" Grid.Column="0"></ContentControl></UserControl>

Step 3 : I am having Module which have

 public class SimpleAccountingModule : IModule
    {
        private readonly IRegionManager regionManager;
        private readonly IUnityContainer container;

        public SimpleAccountingModule(IRegionManager regionManager, IUnityContainer container)
        {
            this.regionManager = regionManager;
            this.container = container;
        }

        public void Initialize()
        {
           regionManager.RegisterViewWithRegion("AccountListPlaceHoldersRegion", typeof(Views.AccountList));
        }
    }

Step 4 : Run the application works perfect no issues.

Step 5: While debugging in Step 3 my region manager count is always zero, and when i am trying to find an element in it getting error region not found. However Views are getting injected properly.

Any help is appreciated


K K Sanghi


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>