How do I navigate back without losing the title bar or going through all the previous pages first?
Is there any way to skip all of the "inbetween" pages and navigate straight back to the first page from the last page in the navigation stack in my .NET MAUI application? (and doing this without showing the animations of all the previous "modal style" pages?)
Here's what I am trying to do:
ItemDetailsPage
/
/
ItemListPage /
\
\
\
NewItemStep1 ____ NewItemStep2 ____ NewItemStep3 ____ ItemDetailsPage
From the ItemListPage
you can do two things:
- Show an item on
ItemDetailsPage
or... - Create a new item in 3 steps: From
NewItemStep1
toNewItemStep2
toNewItemStep3
and finally toItemDetailsPage
displaying your freshly created new item.
Now I want to navigate back from ItemDetailsPage
to ItemListPage
without animating the "between" modal-style pages. So basically just go straight to a new page and animate that, but don't animate the removal of any other pages that are inbetween on the navigation stack.
Here's what I've tried so far:
On the last page (Step 3 page):
Dictionary<string, object> Params = new() {
{"Item", Item }
};
await Shell.Current.GoToAsync($"{nameof(ItemDetailsPage)}", Params);
This will navigate to ItemDetailsPage
and display the created item, as expected! But now the ItemDetailsPage
has no title bar, therefore no back button to go back to any page at all. I assume this messes with the navigation stack in some way.
Dictionary<string, object> Params = new() {
{"Item", Item }
};
await Shell.Current.GoToAsync($"//{nameof(ItemListPage)}");
await Shell.Current.GoToAsync($"{nameof(ItemDetailsPage)}", Params);
And this will navigate to ItemDetailsPage
to display the created item too, with title bar (and back button) to go back to ItemListPage
directly. Perfect! But doing so will go all the way back through Step3
, then Step2
, then Step1
, then ItemListPage
, showing all these pages animate out of the screen, before finally ending up on ItemDetailsPage
to show the created item. This is how I want it to work, but without going back through the previous (1,2,3) steps pages first.