I am currently using MvvmCross
in a Xamarin.Forms
app.
My situation is this, at a certain point in a user journey, the back stack looks like this
Root -> View1 -> View2 -> View3
What I need to do, is navigate from View3 back to View1.
I can't just say
NavigationService.Navigate<ViewMode1>();
As this will simply add it to the back stack, leading to
Root -> View1 -> View2 -> View3 -> View 1
What I need is
Root -> View1
I had a look at the documentation and came across
NavigationService.ChangePresentation(new MvxPresentationHint(typeof(ViewModel1)));
But this doesn't seem to do anything. How can I achieve this?
You can count the number of pages in navigation stack and do like this:
Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 2]);
Hope it may solve your issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.