The functionality for manipulating the back stack is platform and app specific - e.g:
- it's very different manipulating an Android activity backstack than an iOS UINavigation controller one
- it depends on whether your app is using tabs, activities, fragments, flyouts, modals, hamburger menus, etc
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
public class MyFunkyPresentationHint : MvxPresentationHint
{
public int DegreeOfFunkiness { get; set; }
}
- You can create and send this hint from any ViewModel
base.ChangePresentation(new MyFunkyPresentationHint() { DegreeOfFunkiness=27 });
- In your custom presenter, you can then do the backstack-screen-hacking you desire:
public override void ChangePresentation(MvxPresentationHint hint)
{
if (hint is MyFunkyPresentationHint)
{
// your code goes here
return;
}
base.ChangePresentation(hint);
}
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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…