WPF Prism 7.0+ IRegionManager(区域)
源码下载:PrismCore.zip
创建区域模块:
示例结果:
MainWindow.xaml 调用区域模块:
<Grid> <Grid.RowDefinitions> <RowDefinition Height="28"/> <RowDefinition Height="*"/> <RowDefinition Height="28"/> </Grid.RowDefinitions> <ContentControl Grid.Row="0" prism:RegionManager.RegionName="HeaderRegin" x:Name="Header"/> <ContentControl Grid.Row="2" prism:RegionManager.RegionName="FooterRegin" x:Name="Footer"/> </Grid>
MainWindow.cs 注册模块:
RegionManager.SetRegionName(Header, "HeaderRegin"); regionManager.RegisterViewWithRegion("HeaderRegin", typeof(Regions.HeaderControl)); RegionManager.SetRegionName(Footer, "FooterRegin"); regionManager.RegisterViewWithRegion("FooterRegin", typeof(Regions.FooterControl));