The default ViewModel caching, which attempts to circumvent Android rotation behavior, is based on IMvxSingleViewModelCache - so itβs not too surprising that it cannot handle multiple actions and multiple view modes.
Here, where this interface is declared and used, see https://github.com/slodge/MvvmCross/search?q=IMvxSingleViewModelCache&ref=cmdform
If this behavior bothers you, you should be able to get around it with one of:
1. Use tabs based on fragments, not based on actions
Android handles the fragment life cycle differently for Activity.
2. Or continue to use activity-based tabs, but make your own IMvxSingleViewModelCache
It should be simple, for example, to identify the models of your child view using their "Child" naming convention.
After that, you can implement something like:
public class MyCustomViewModelCache : IMvxSingleViewModelCache { private const string BundleCacheKey = "__mvxVMCacheKey"; private int _counter; private IMvxViewModel _currentViewModel; public void Cache(IMvxViewModel toCache, Bundle bundle) { if (toCache != null && toCache.GetType().Name.StartsWith("Child")) {
This class is based on MvxSingleViewModelCache.cs with just one small addition.
You can register an instance of this class as IMvxSingleViewModelCache singleton during InitializeLastChance your installation.
Mvx.RegisterSingleton<IMvxSingleViewModelCache>(new MyCustomViewModelCache());
In this case, the home / tab action should (I think) continue to work - and it will transmit viewmodels to the children of the tab after rotation.
(Other possibilities are possible for IMvxSingleViewModelCache - for example, it can cache several view models), but please do not let too many view models cache too much or you may run into "out of memory")
3. Or turn off Android rotation processing
If you add the android:configChanges="orientation" flag (or its equivalent equivalent to a monodroid), you can simply handle the rotation yourself.