Search code examples
wpfmenuprismregionscal

Nested menu regions in Composite WPF application


Is it possible to have nested regions in a Composite WPF application? I want modules to be able to inject new menus, and also be able to inject menu items into an existing menu.

Using the following code the RegionManager throws an exception:

The region manager does not contain the MainFileMenuRegion region

<Menu cal:RegionManager.RegionName="MainMenuRegion">
    <MenuItem cal:RegionManager.RegionName="MainFileMenuRegion" Header="_File" />
</Menu>

Solution

  • One workaround I've come up with is to simply use two Menus arranged with a Grid. The first one has all my standard menus and allows me to inject into each one individually. The second is empty and allows me to inject new top-level menus.