Add PRISM Region Manager In Existing Navigation Window
Posted
by Nate Noonen
on Stack Overflow
See other posts from Stack Overflow
or by Nate Noonen
Published on 2010-05-07T19:14:43Z
Indexed on
2010/05/07
19:18 UTC
Read the original article
Hit count: 1035
We have a "legacy" WPF applicaton that is based on a NavigationWindow. The NavigationWindow has a fairly large ControlTemplate that houses a ContentPresenter as so:
<ControlTemplate>
....snip...
<ContentPresenter x:Name="PART_NavWinCP" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
.....snip....
</ControlTemplate>
What we want to do is use that ContentPresenter as the first tab and dynamically add other tabs at run time. Like this:
<ControlTemplate>
....snip...
<TabControl Background="Transparent" cal:RegionManager.RegionName="MainRegion" Grid.ColumnSpan="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<TabItem Header="Nav Window Content">
<ContentPresenter x:Name="PART_NavWinCP" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
</TabItem>
</TabControl>
.....snip....
</ControlTemplate>
Then our Modules grab the RegionName and insert their content dynamically. The issue seems to be that the PRISM region manager doesn't like that our code is in a ContentTemplate and cannot resolve the region. I have tried updating the RegionManager, adding the Region dynamically, just having a root tab control without the ContentPresenter, but I cannot get this to work. Any ideas?
© Stack Overflow or respective owner