我在 Xamarin Forms 应用程序中使用来自 VS2019 的 Shell 模板。我在 shell 弹出窗口中列出了两个页面。
<FlyoutItem Title="Home" Icon="icon_about.png">
<ShellContent Route="HomePage" ContentTemplate="{DataTemplate local:HomePage}" />
</FlyoutItem>
<FlyoutItem Title="Logoff time" Icon="icon_about.png">
<ShellContent Route="SecondPage" ContentTemplate="{DataTemplate
local:SecondPage}" />
</FlyoutItem>
使用汉堡菜单,我从主页导航到另一个页面 SecondPage。我在 SecondPage 上有一个按钮,它执行一个操作,我想从该操作导航回主页。当我使用此代码时:
var route = $"{nameof(HomePage)}";
await Shell.Current.GoToAsync(route);
主页显示,但有一个后退按钮而不是汉堡菜单。如果我点击汉堡图标,页面将导航回 SecondPage。如何从 SecondPage 导航到 HomePage 并显示汉堡图标?