Hello,
While going on with the refactoring of my app to take advantage of Shell and Routing, I'd like to discuss what the best option for following use case.
I have hierarchical data with a list page, a detail page showing detail of the element and list of subelements. Let's take an example based on the sample for the Shell Flyout:
- Page "Animals" (route =
animals
)- Monkeys (route =
species
, parameter =type=monkeys
) - Elephants (route =
species
, parameter =type=elephants
)
- Monkeys (route =
On the "detail page" of an animal (thus route=animals/species
), we show a list of corresponding animals where again we may show details, thus we could have a detail page for a gorilla and the same XAML page but with different parameter to show a Orang-Outan or an Asian Elephant.
When NOT using routes, you just push new detail page onto the Navigation stack and that's fine, when you go back you are in the proper context of either monkeys or elephants.
Now, somewhere else in my app I have a way to directly navigate to a detail page (this could be for instance the result of a search page going over both monkeys and elephants) and I'd like from that context go to the detail page of a gorilla. I will need a call of the form:
Shell.Current.GoToAsync("//animals/species/profile?animal=gorilla");
and it will work, but when going back to the species
page, I won't be in the context of monkeys.
I could possibly navigate to "//animals/species/profile?animal=gorilla&type=monkeys"
(did not test) but this is not really pretty and possibly this won't work as I suspect the type
argument would be passed to the profile page and not available anymore to the species page.
Nevertheless, what would be the best practice for such use case?