public class ModelA : BaseViewModel
{
public override void OnNavigatedTo(NavigationParameters {
param = parameters.GetValue("param");
}
private async void Execute(){
var p = new NavigationParameters();
p.Add("wo", param);
await _navigationService.NavigateAsync("Page2", p);
}
}
在第2页视图模型中
public override async void OnNavigatedTo(NavigationParameters parameters)
{
Param = parameters.GetValue("param");
}
public override void OnNavigatedFrom(NavigationParameters parameters){
var p = new NavigationParameters();
p.Add("param", Param);
_navigationService.NavigateAsync("Page1", p);
//_navigationService.GoBackAsync(p,true);
}
当我按下左上方的后退按钮时,我正在点击OnNavigatedFrom但是在Page1 vm中,在点击OnNavigatedTo之后,param为null