非导航模式
1.同一个Region可注册多个UserControl
regionManager.Resolve<IRegionManager>().RegisterViewWithRegion("mainRegion", typeof(UserControl1));
regionManager.Resolve<IRegionManager>().RegisterViewWithRegion("mainRegion", typeof(UserControl2));
2.获取指定的UserControl
containerProvider.Resolve<IRegionManager>().Regions["mainRegion"].Views.ElementAt(index));
2.显示指定的UserControl
containerProvider.Resolve<IRegionManager>().Regions["mainRegion"].Activate(view);
导航模式
1.注册多个可导航UserControl
containerRegistry.RegisterForNavigation<UserControl2, UserControl2ViewModel>("UserControl2");
containerRegistry.RegisterForNavigation<UserControl2, UserControl2ViewModel>("UserControl2");
2.导航
containerProvider.Resolve<IRegionManager>().Regions["mainRegion"].RequestNavigate("UserControl1", callback=>
{
if ((bool)callback.Result)
{
journal = callback.Context.NavigationService.Journal;
}
});
标签:Resolve,Region,Regions,containerProvider,UserControl,mainRegion From: https://www.cnblogs.com/xiuju/p/17774869.html