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));
我下面的开发人员指南,如果视图存在,它不会改变的观点。
你不应该注册你的类型对基本接口,而不是'对象'类型? – 2011-05-08 09:53:04
在开发者指南中,它用这种方式写,我不知道哪个基础接口,你的意思是IModule? – viewer20q 2011-05-09 11:54:34
你指的是哪个开发人员指南? – 2011-05-09 13:54:17