问题
I have navigation stack like this:
Page1 -> Page2 -> Page3 -> Page4 -> Page5 -> Page6
And I want to Navigate TO Page2 FROM Page6 and clear rest of pages (Page3, Page4, Page5)
How can I do this?
Thanks in advance!
回答1:
When you want to navigate back a count of pages, you need to remove count pages from the navigation stack:
for (var i = 1; i < countPagesToRemove; i++)
{
Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 2]);
}
await Navigation.PopAsync();
来源:https://stackoverflow.com/questions/50857611/go-to-page-and-clear-the-stack-xamarin-forms