我有一个父外壳标签页。我希望能够从这个父页面的一个 contentPage 导航到另一个 shell 选项卡页面。
2297 次
1 回答
7
可以通过将有效的绝对 URI 指定为 GoToAsync 方法的参数来执行导航:https ://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/shell/navigation#perform-navigation
在OnItemSelected
方法上,调用下面的代码。
await (App.Current.MainPage as Xamarin.Forms.Shell).GoToAsync("//tabbar/tab/about", true);
AppShell.xaml:设置路由。
<TabBar Route="tabbar">
<Tab Title="Browse" Icon="tab_feed.png">
<ShellContent ContentTemplate="{DataTemplate local:ItemsPage}" />
</Tab>
<Tab Title="About" Icon="tab_about.png" Route="tab">
<ShellContent Route="about" ContentTemplate="{DataTemplate local:AboutPage}" />
</Tab>
</TabBar>
于 2019-11-04T06:16:45.923 回答