9

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

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

我怎么能在 Windows 10 中做到这一点?

4

2 回答 2

15

如果您在页面代码后面,您是否尝试过:

this.Frame.BackStack.Clear();

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

var frame = Window.Current.Content as Frame;
frame.BackStack.Clear();
于 2015-08-08T16:19:34.437 回答
0

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

protected override void OnNavigatedFrom(NavigationEventArgs e){
  if (this.GetType().HasRegionAttribute()){
        base.PopFromBackStackTo(typeof(LastViewModel));
  }    
  base.OnNavigatedFrom(e);
}
于 2018-02-19T11:04:35.373 回答