清除后台堆栈导航Windows 10
我想清除我的导航返回堆栈历史…
我试图使用this.NavigationService.RemoveBackEntry();
但它没有用。
我怎么能在Windows 10中这样做?
如果您的页面代码落后,您是否尝试过:
this.Frame.BackStack.Clear();
或者如果你在其他地方(比如ViewModel),你尝试过:
var frame = Window.Current.Content as Frame; frame.BackStack.Clear();
在后面的代码中,您可以尝试这样:
protected override void OnNavigatedFrom(NavigationEventArgs e){ if (this.GetType().HasRegionAttribute()){ base.PopFromBackStackTo(typeof(LastViewModel)); } base.OnNavigatedFrom(e); }