Prism code sample learning: 02-Regions

1 minute read

Prism code sample learning: 02-Regions


This is a continuation of the following article.


In this sample, it seems to be a sample that gives a name to a region using the RegionManager class.

<Window x:Class="Regions.Views.MainWindow"
        Title="Shell" Height="350" Width="525">
        <ContentControl prism:RegionManager.RegionName="ContentRegion" />
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : PrismApplication
        protected override Window CreateShell()
            return Container.Resolve<MainWindow>();

        protected override void RegisterTypes(IContainerRegistry containerRegistry)

Is it the following as a point?

–Last time, Bootstrapppr was used, but the PrismApplication class that hides the Bootstrapper is used.
–The base class of PrismApplication is here
–In MainWindow, “ContentRegion” is set in the RegionManager.RegionName property, which is an attached property to the ContentControl control.
–RegionManager is here [
–Once the name is set, you can specify the area and change the screen.
–The simplest to use RequestNavigate () method
–The content specified by URI is displayed in the regionName specified by the argument.
-See also Qiita article

in conclusion

This time I read the source code of the RegionManager class and found out how to name the region.
It seems that you can add more views later by defining the name in the area via RegionManager and registering various contents.
Next time, I’ll look at 03-Custom Regions.