MVVM Prism Nested Regions Can't Find Child Regions

Posted by Garry Clark on Stack Overflow See other posts from Stack Overflow or by Garry Clark
Published on 2010-03-26T14:08:20Z Indexed on 2010/03/26 14:53 UTC
Read the original article Hit count: 1282

Filed under:
|
|
|
|

I have a Menu (Telerik RadMenu) that has nested regions defined in the Shell. In my modules I will register the modules menu or toolbar items with these regions. Everything works fine for the root regions, but when I try and add something to a child region, such as the File region on the Menu, I get the error "The exception message was: The region manager does not contain the FileMenuRegion region."

However like I said if I change this code

regionManager.Regions[RegionNames.FileMenuRegion].Add(menuItem);

to this

regionManager.Regions[RegionNames.MainMenuRegion].Add(menuItem);

everything works fine. Below is the XAML for my menu so you can see the region names and how they are constructed. Any help would greatly be appreciated as this is bewildering and driving me crazy.

Menu

    <telerikNavigation:RadMenu x:Name="menuMain" DockPanel.Dock="Top" prismrgn:RegionManager.RegionName="{x:Static i:RegionNames.MainMenuRegion}" telerik:StyleManager.Theme="{Binding Source={StaticResource settings}, Path=Default.CurrentTheme}">
            <telerikNavigation:RadMenuItem Header="{x:Static p:Resources.File}" prismrgn:RegionManager.RegionName="{x:Static i:RegionNames.FileMenuRegion}">
                <telerikNavigation:RadMenuItem Header="{x:Static p:Resources.Exit}" Command="{Binding ExitCommand}">
                    <telerikNavigation:RadMenuItem.Icon>
                        <Image Source="../Resources/Close.png" Stretch="None" />
                    </telerikNavigation:RadMenuItem.Icon>
                </telerikNavigation:RadMenuItem>
            </telerikNavigation:RadMenuItem>
        </telerikNavigation:RadMenu>

© Stack Overflow or respective owner

Related posts about prism

Related posts about regions