【问题标题】:Clear Back Stack Navigation Windows 10清除返回堆栈导航 Windows 10
【发布时间】:2015-10-31 09:38:08
【问题描述】:

我想清除我的导航返回堆栈历史...

我尝试使用this.NavigationService.RemoveBackEntry();,但没有成功。

如何在 Windows 10 中执行此操作?

【问题讨论】:

    标签: c# windows-10 windows-10-mobile


    【解决方案1】:

    在后面的代码中,你可以试试这个:

    protected override void OnNavigatedFrom(NavigationEventArgs e){
      if (this.GetType().HasRegionAttribute()){
            base.PopFromBackStackTo(typeof(LastViewModel));
      }    
      base.OnNavigatedFrom(e);
    }
    

    【讨论】:

      【解决方案2】:

      如果你在页面代码后面,你有没有尝试过:

      this.Frame.BackStack.Clear();
      

      或者如果您在其他地方(例如 ViewModel),您是否尝试过:

      var frame = Window.Current.Content as Frame;
      frame.BackStack.Clear();
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-04-13
        • 1970-01-01
        • 2015-06-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多