Search code examples
iosxamarinmvvmcross

Prevent View from entering the history stack


Having three Views A, B, C with navigation in the the following order:

A => B => C

where all three views are added to the history stack, the back navigation is in the following order:

C => B => A

Is there a way to navigate back from View C to View A and skipping View B?

C => A

I am using MvvmCross with Xamarin.ios.

Thanks!


Solution

  • As said by suart; Gshackles has some great blog posts about the presenters in MvvmCross. One of them is: http://www.gregshackles.com/presenters-in-mvvmcross-manipulating-the-back-stack/

    The line of code that you could use is:

    MasterNavigationController.PopToViewController(existingViewController, true);
    

    Or if you just want to go back to the first (aka root): http://gregshackles.com/presenters-in-mvvmcross-using-presentation-values/

    MasterNavigationController.PopToRootViewController(false);