1
votes

I am developing an app for Android (later also iOS) using Xamarin and MvvmCross (currently 5.6.2). I am using the native UIs of both platforms (Xamarin.Android, Xamarin.iOS).

The app has a hierarchial, folder like structure. Navigating into this structure and navigating back is working fine in the simple case.

In some cases though I need to navigate into this hierarchial structure from another top level view model. To support proper back navigation the navigation stack should change from i.e.

home -> vm1

to

home -> root -> folder -> folder -> vm2

Currently I call await NavigationService.Close() in vm1, work with the returned value in home, then do a series of calls to await NavigationService.Navigate<>() there to reach vm2.

The navigation (also back) is working fine, but during the transition to vm2 the views of home etc. are briefly displayed. This is really distracting.

How can I navigate through multiple view models (and work with return values etc.), but not display the views except for the final one?

1

1 Answers

0
votes

This is not possible with MVVMCross since it allows only to Navigate to a specific VM. With the normal Xamarin.Forms navigation you could use:

Navigation.InsertPageBefore (page, before);
Navigation.RemovePage (page);

And modify your navigation stack, inserting or removing the pages you need.

Documentation