I'm writing a cross-platform app for iOS and Android using MvvmCross.
The Android version makes use of nested Fragments. For example, the home view is a navigation drawer, its various navigation hub views are Fragments which may be split views containing other fragments, and on top of that, each view may show a dialog fragment as well.
Additionally, not all ViewModels are shown via ShowViewModel(), some of them are used more like PropertyChanged event providers as demonstrated in the N=32 video.
This is working fine until a configuration change takes place (typically, rotating the device). When the fragment views get recreated, their View Models aren't and are set to null. This is hinted at in the following MvvmCross issue #636, where Stuart also mentions he'd like the project to come up with some best practice advice.
My question now is what are the best practices for this? What do you do if you have to properly support Android configuration changes in MvvmCross?
I've tried working around the problem as outlined in the issue linked above, i.e. by some form of ViewModel registry in the parent ViewModels, and also by trying to serialize the Fragment's ViewModel when saving its instance state, with limited success. The results felt hackish at best. The problem remains that a Fragment doesn't know how to recreate its View Model in MvvmCross. Oh, and disabling configuration changes on device rotation doesn't count as an answer. ;-)