Regions Prism framework of use

Regions Prism frame, the user can control, and the like attached to the main form specified in the control form.

[Actual]

1, the new Prsm Blank App (WPF) project: Demo0810

Views of the folder, right-click - Add - New Item --Prism - Prism UserControl (WPF), the default name

MainWindow.xaml.cs Code:

the using System.Windows;
 the using Prism.Regions; // introduced Regions

 namespace Demo0810.Views 
{ 
    public  partial  class the MainWindow: the Window 
    { 
        public the MainWindow (IRegionManager RegionManager) // define variables 
        { 
            the InitializeComponent (); 
            // be loaded into the main user controls PrismUserControl1 form ContenRegion control 
            regionManager.RegisterViewWithRegion ( " ContentRegion " , typeof (PrismUserControl1));  
        } 
    } 
}

PrismUserControl1.xaml Code: other files intact

<UserControl x:Class="Demo0810.PrismUserControl1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:prism="http://prismlibrary.com/"             
             prism:ViewModelLocator.AutoWireViewModel="True">
    <Grid>
        <TextBlock Text="View A" FontSize="38" />
    </Grid>
</UserControl>

 

Guess you like

Origin www.cnblogs.com/xixixing/p/11330754.html