I have two questions regarding navigation in MvvMCross.
- How can I go back to a view model, that is on the navigation stack? Respectively: How can I go back a specified number of view models?
How can I truncate the navigation stack?
e.g: A|B|C on the stack, navigating to D makes the stack look like: D
There is a nice article with information to do it here. That covers iOS and Android fragments based navigation. There is a situation missing that is Activity based navigation. For that particular case, android intents can help adding some flags to it.
Note that
ActivityFlags.ClearTask | ActivityFlags.NewTask
will make your new activity to be the only one on the stack.The functionality for manipulating the back stack is platform and app specific - e.g:
Because of this, the actual implementation of UI changes like this is not defined within MvvmCross.
Instead, it's up to you to implement in your applications
presenter
.The basic flow you'll need to follow is:
Work out what your app structure is and what effect(s) you want to achieve
For this effect, declare a custom presentation hint - e.g
For examples of custom presenters, see: http://slodge.blogspot.com/2013/06/presenter-roundup.html
For one example of backstack manipulation, see how
Close(this)
is implemented in some of the standard presenters.