如何处理棱镜中的左上后键

时间:2017-08-02 00:50:04

标签: xamarin.forms prism

 
    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

1 个答案:

答案 0 :(得分:0)

看一下这篇文章,对你有用:

LINK