I have a user control where I have multiple Prism regions defined for injecting views. I decided to use the Prism view navigation for dealing with switching my "SelectedMenuContentRegion" based on user actions (as shown below) and I have run into a problem. I am sure the problem is with my usage, but I have not been able to figure out what I am doing wrong. I have the following user control which contains a custom WPF control.
<Grid>
<commonwpfcontrols:NavigationPane Background="{StaticResource SecondaryColorBrush}" IsExpanded="False" MenuItems="{Binding MenuItems}">
<commonwpfcontrols:NavigationPane.Content>
<ContentControl prism:RegionManager.RegionName="MapRegion"/>
</commonwpfcontrols:NavigationPane.Content>
<commonwpfcontrols:NavigationPane.SelectedMenuContent>
<ContentControl prism:RegionManager.RegionName="SelectedMenuContentRegion"/>
</commonwpfcontrols:NavigationPane.SelectedMenuContent>
</commonwpfcontrols:NavigationPane>
<Grid>
<ContentControl prism:RegionManager.RegionName="ApplicationOverlay"/>
</Grid>
There are 3 regions defined. If I do the standard
mRegionManager.RegisterViewWithRegion("SelectedMenuContentRegion", () => mUnityContainer.Resolve<MapSettingsView>());
It works as expected, however, if I register the view for navigation like the following:
mUnityContainer.RegisterTypeForNavigation<MapSettingsView>();
and then attempt to navigate sometime later
mRegionManager.RequestNavigate("SelectedMenuContentRegion ", "MapSettingsView", NavigationComplete);
It fails. I Noticed in the debugger that the region manager only had the “ApplicationOverlay” region in it's list of regions. So, I changed the region that I was navigating to, to the ApplicationOverlay region as a test, and it worked. I am getting the region manager through dependency injection. Any clue as to why the other defined regions are not known to the region manager?
Update Since more detailed information is required, I created a small standalone sample that shows the failed navigation. Prism Navigation Sample