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

前端 未结 5 1002
一生所求
一生所求 2021-02-07 04:27

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:

NavigationPag

5条回答
  •  星月不相逢
    2021-02-07 04:49

    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();
    

提交回复
热议问题