【发布时间】:2018-03-04 19:09:13
【问题描述】:
在每个视图中
public partial class View2 : UserControl, IRegionMemberLifetime, INavigationAware
{
public bool KeepAlive
{
get { return false; }
}
bool INavigationAware.IsNavigationTarget(NavigationContext navigationContext)
{
return true;
}
void INavigationAware.OnNavigatedFrom(NavigationContext navigationContext)
{
// Intentionally not implemented.
}
void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
{
this.navigationJournal = navigationContext.NavigationService.Journal;
}
}
初始化:
container.RegisterType<object, View1>("View1");
container.RegisterType<object, View2>("View2");
regionManager.RequestNavigate("Window1", new Uri("View1", UriKind.Relative));
regionManager.RequestNavigate("Window2", new Uri("View2", UriKind.Relative));
我正在关注开发者指南,如果视图存在,它不会更改视图。
【问题讨论】:
-
您不应该根据基本接口而不是
object类型注册您的类型吗? -
在开发者指南中是这样写的,我不知道是哪个基础接口,你是说IModule吗?
-
您指的是哪个开发者指南?
-
微软官方开发者指南