Is there any way to get previous page url in silverlight navigation application

后端 未结 2 1267
栀梦
栀梦 2021-01-24 09:44

Is there any way to get previous page url in silverlight navigation application. I am using navigation Service.

2条回答
  •  自闭症患者
    2021-01-24 10:30

    There is no way to get the navigation history, you can store it by yourself by listening the navigation service event NavigationService.Navigated (or Frame.Navigated for frame navigation).

    private List _navigationHistory = new List();
    
    void  onNavigated(object sender, NavigationEventArgs e)
    {
        _navigationHistory.Add(e.Uri);
    }
    
    private Uri getBackUri()
    {
            return _navigationHistory.Count > 1
                ? _navigationHistory[_navigationHistory.Count - 2]
                : null;
    }
    

提交回复
热议问题