WPF导航(三)
带有返回值的导航
一、设置PageFunction
xmlns:src = "clr-namespace:类1的名字空间"
x:TypeArguments = "src:类1"
RemoveFromJournal = true
二、PageFunction中返回值
1.返回正常值
OnReturn(new ReturnArgs<类1>(new 类1()));
2.返回空值
OnReturn(null);
三、Page中导航到PageFunction
PageFunction01 pf = new PageFunction01();
pf.Return += (obj, arg){
if(null == arg) {
//some code
}else{
//arg.Result -- 返回的类
}
}
NavigationService nav = NavigationService.GetNavigationService(this);
nav.Navigate(pf);