I’m having trouble with my Xamarin Forms Shell app. I'm not sure if this is a bug or expected behaviour, can someone point me in the right direction.
I have an app with 2 pages in the Visual Shell Hierarchy:
Search & History
<FlyoutItem Title="Search" Icon="search.png">
<Tab Title="Search">
<ShellContent Route="searchpage">
<views:SearchPage />
</ShellContent>
</Tab>
</FlyoutItem>
<FlyoutItem Title="History" Icon="history.png">
<Tab Title="History">
<ShellContent>
<views:HistoryPage />
</ShellContent>
</Tab>
</FlyoutItem>
And several pages (let’s call them PageA, PageB and PageC) registered like so:
Routing.RegisterRoute("PageA", typeof(PageA));
Routing.RegisterRoute("PageB", typeof(PageB));
Routing.RegisterRoute("PageC", typeof(PageC)); (Oops, I should probably use nameof here)
Anyway, I start on the Search page and navigate to PageA like so:
Shell.Current.GoToAsync("PageA");
Because PageA is not in the visual hierarchy, this gives me a navigation stack like so:
"//searchpage/PageA"
Using the same relative navigation approach, I navigate to PageB then PageC, so my navigation stack is like so:
"//searchpage/PageA/PageB/PageC"
From PageC, I use the flyout menu to navigate to History, the history page opens fine.
Now on the history page, I use the flyout menu again and click the Search tab
But I'm not taken to the search page as expected, I'm taken back to PageC (taken back to my previous navigation stack).
From this page (PageC) if I use the flyout menu again and click the Search tab, it navigates correctly to the Search page.
How should this work and how can I stop it navigating to PageC when I select the Search tab from the flyout?
Thanks
(ps - I'm using Xamarin Forms 4.7 at present)
Shell.Current.GoToAsync
, the next page will not show theFlyoutIcon
menu. Therefore, from PageC, you could share the code of how to use the flyout menu to navigate to History. – Junior Jiang