我正在将现有代码迁移到 Xamarin Forms 4.0 Shell
,以前我正在使用TabbedPage
,但现在我想使用Shell
Tabs。
以下是迁移后代码的样子。我注意到的是它只显示一个顶部选项卡,该选项卡在列表中具有最后一个条目。就我而言,它只显示 Tab2。
<Shell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:App.Views.Tabs;assembly=App"
x:Class="App.Views.AppShell"
x:Name="self">
<TabBar>
<Tab>
<ShellContent>
<views:Tab1Page BindingContext="{x:Reference self}" Title="Tab1" />
<views:Tab2Page BindingContext="{x:Reference self}" Title="Tab2"/>
</ShellContent>
</Tab>
</TabBar>
</Shell>