I use in the application of WPF and Prism with UnityContainer. Inside the application, a separate window is launched with the following contents:
<StackPanel Grid.Column="0"> <RadioButton Margin="5" Command="{Binding AutoSchemeCommand}" Content="Auto" /> <RadioButton Margin="5" Command="{Binding SingleSchemeCommand}" Content="Individual" /> <RadioButton Margin="5" Command="{Binding SelectSchemeCommand}" Content="Select from scheme" /> </StackPanel> <ContentControl Grid.Column="1" Margin="10,0" regions:RegionManager.RegionName="TypeSchemeRegion" /> That is, the window contains the region in which the content will change by pressing the corresponding RadioButton. To do this, there are appropriate subwindows and in the start module they are initialized:
RegionManager.RegisterViewWithRegion("TypeSchemeRegion", typeof(SchemeAutoView)); RegionManager.RegisterViewWithRegion("TypeSchemeRegion", typeof(SchemeSingleView)); RegionManager.RegisterViewWithRegion("TypeSchemeRegion", typeof(SchemeSelectView)); When you open a window from the program, the following code is executed:
var schemeView = unityContainer.Resolve<SchemeView>(); regionManager.Regions.Remove("TypeSchemeRegion"); RegionManager.SetRegionManager(schemeView, regionManager); (SchemeView is the most launched window) In this place all three sub-windows are in the Views list of the region, the active window (ActiveView) is SchemeAutoView. When you start the window, the contents of the SchemeAutoView pane are displayed. By pressing the corresponding RadioButton, the code is executed:
_regionManager?.RequestNavigate("TypeSchemeRegion", new Uri("SchemeSingleView", UriKind.Relative)); or:
_regionManager?.RequestNavigate("TypeSchemeRegion", new Uri("SchemeSelectView", UriKind.Relative)); Now, if you check the contents of the region in Debuge, the active window changes accordingly. However, nothing happens on the screen, the first active sub-window is still displayed. For all windows use one ViewModel. The most interesting thing is that the same method is used in the main application window (Shell) and everything works with a bang, and does not want to work in a separate window. What am I doing wrong?