Navigation in Xamarin Forms with Custom Movement between pages

prinil1420prinil1420 Member ✭✭

So I have one requirement where user go From Page1 -> Page2 -> Page3 -> Page4 and after Page4, He has to return back to Page2 and If he press back button he should navigate it back to Page1.

How to achieve this in Xamarin Forms.?

I tried like this,

Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 1]);
_ = Navigation.PopAsync(true);
But it's giving weird animation and not working properly.

Please help me on this.

Best Answer

Answers

  • VovaKamishnikovVovaKamishnikov USMember ✭✭✭
    edited May 13

    Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 1]);

    I think there should be 2.
    First, remove Page3 and then pop Page4
    I did it, this approach works

    The main point is you should remove all pages between the last page and target page and after that pop the last page

  • prinil1420prinil1420 Member ✭✭

    Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 2]);
    _ = Navigation.PopAsync(true);

    Yes I updated it like this.. But animation shows that first one page disaster and then the second page.. I want that directly it should come to Page 2.. User should not see Page3

  • prinil1420prinil1420 Member ✭✭

    Thanks Man.. Worked :)

Sign In or Register to comment.