I tried two approaches:
1.
public class SavedState
{
public string Data1 { get; set; }
public string Data2 { get; set; }
}
public void ReloadState(SavedState state)
{
//Data1 and Data2 always have null values.
}
public SavedState SaveState() {
return new SavedState
{
Data1 = "AAAA",
Data2 = "BBBB"
};
}
2.
protected override void ReloadFromBundle(IMvxBundle state)
{
base.ReloadFromBundle(state);
//state.Data has 0 elements.
}
protected override void SaveStateToBundle(IMvxBundle bundle)
{
bundle.Data["Data1"] = "AAAA";
bundle.Data["Data2"] = "BBBB";
base.SaveStateToBundle(bundle);
}
What am I doing wrong? The ReloadStateand ReloadFromBundle methods are called but with null parameters. I have only Windows Store target, with custom presenter which shows view this way:
_rootFrame.Navigate(GetViewType(request), request);
Yesterday I had similar issue.
I used this code to show ViewModel with parameter:
ShowViewModel<UserAccountViewModel>(new UserAccountViewModelParams{ FromLogin = true });
and tombstoning behaved exactly like in your case.
When I changed it to:
ShowViewModel<UserAccountViewModel>();
it worked.
I guess it's MVX error.