XAML .NET MAUI -选项卡中的嵌套选项卡

gdrx4gfi  于 2022-12-07  发布在  .NET
关注(0)|答案(1)|浏览(328)

我正在开发一个应用程序来显示一些体育统计数据,在这个例子中就是排名。当我选择“排名”页面时,我在有“总体”、“会议”和“部门”标签的地方工作,没有问题。不过,我在标签内嵌套标签时遇到了麻烦。例如,当我转到“会议”页面时,我想要“东部”和“西部”作为子选项卡。我试图添加另一个选项卡控件,但我没有看到任何区别。

<FlyoutItem Route="standings" FlyoutDisplayOptions="AsMultipleItems">
    <Tab Title="Standings" Route="standings" Icon="standings.png">
        <ShellContent Route="overallstandings"
                      Style="{StaticResource StandingsShell}"
                      Title="Overall"
                      Icon="overall.png"
                      ContentTemplate="{DataTemplate views:OverallStandingsPage}" />
        <ShellContent Route="conferencestandings"
                      Style="{StaticResource StandingsShell}"
                      Title="Conference"
                      Icon="conference.png"
                      ContentTemplate="{DataTemplate views:EasternConferenceStandingsPage}">
                      <Tab Title="Conference">
                          <ShellContent Route="easternconferencestandings"
                            Style="{StaticResource StandingsShell}"
                            Title="Eastern"
                            Icon="eastern.png"
                            ContentTemplate="{DataTemplate views:EasternConferenceStandingsPage}" />
                          <ShellContent Route="westernconferencestandings"
                            Style="{StaticResource StandingsShell}"
                            Title="Western"
                            Icon="western.png"
                            ContentTemplate="{DataTemplate views:WesternConferenceStandingsPage}" />
                      </Tab>
        </ShellContent>
        <ShellContent Route="divisionstandings"
                      Style="{StaticResource StandingsShell}"
                      Title="Division"
                      Icon="division.png"
                      ContentTemplate="{DataTemplate views:DivisionStandingsPage}" />
    </Tab>
</FlyoutItem>
bf1o4zei

bf1o4zei1#

另一个选择,在重读之后,我想你正在寻找的是使用标签栏。尝试以下:

<TabBar>
        <ShellContent Route="overallstandings"
                      Style="{StaticResource StandingsShell}"
                      Title="Overall"
                      Icon="overall.png"
                      ContentTemplate="{DataTemplate views:OverallStandingsPage}" />
        <ShellContent Route="conferencestandings"
                      Style="{StaticResource StandingsShell}"
                      Title="Conference"
                      Icon="conference.png"
                      ContentTemplate="{DataTemplate views:EasternConferenceStandingsPage}">
            <Tab Title="Conference">
                <ShellContent Route="easternconferencestandings"
                            Style="{StaticResource StandingsShell}"
                            Title="Eastern"
                            Icon="eastern.png"
                            ContentTemplate="{DataTemplate views:EasternConferenceStandingsPage}" />
                <ShellContent Route="westernconferencestandings"
                            Style="{StaticResource StandingsShell}"
                            Title="Western"
                            Icon="western.png"
                            ContentTemplate="{DataTemplate views:WesternConferenceStandingsPage}" />
            </Tab>
        <ShellContent Route="divisionstandings"
                      Style="{StaticResource StandingsShell}"
                      Title="Division"
                      Icon="division.png"
                      ContentTemplate="{DataTemplate views:DivisionStandingsPage}" />
    </TabBar>

相关问题