Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to PopAsync more than 1 page in Xamarin Forms Navigation?

Tags:

In my app I'm pushing pages using a NavigationPage and at some stage I want to go back to a previous page in the stack. This is my structure:

NavigationPage > Page1 > Page2 > Page3 > Page4

How can I PopAsync back to Page2 directly from Page4 without going through Page3?

like image 854
Francisco Hermida Avatar asked Jul 21 '14 00:07

Francisco Hermida


1 Answers

If you have a count that you would like to pop, this works really well.

for (var counter = 1; counter < BackCount; counter++) {     Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 2]); } await Navigation.PopAsync(); 
like image 192
Caitlin Avatar answered Oct 03 '22 04:10

Caitlin