0

我正在使用 Xamarin.Forms Shell,并且底部选项卡栏导航没有弹出。

<TabBar Route="tabs">
        <Tab Title="Page1" Route="page1" Icon="page1.png">
            <ShellContent ContentTemplate="{DataTemplate local:Page1}" />
        </Tab>
        <Tab Title="Page2" Route="page2" Icon="page2.png">
            <ShellContent Route="page2A" ContentTemplate="{DataTemplate local:Page2A}" />
            <ShellContent Route="page2B" ContentTemplate="{DataTemplate local:Page2B}" />
        </Tab>
        <Tab Title="Page3" Route="page3" Icon="page3.png">
            <ShellContent ContentTemplate="{DataTemplate local:Page3}" />
        </Tab>
</TabBar>

我希望使用 GoToAsync("tabs/page2/page2A") 和 GoToAsync("tabs/page2/page2B")以编程方式确定page2 选项卡的内容。

这样,当用户在选项卡之间导航以显示哪个 ShellContent(例如 page2A 或 page2B)时,应该有持久性。

该行为工作正常,但我想隐藏允许用户在两​​个 ShellContent 页面之间导航的 TOP 选项卡栏。有没有办法在 Xamarin.Forms Shell 中做到这一点?

4

1 回答 1

0

I can't find a way to do this with routes. The desired behaviour can be achieved with:

(Shell).CurrentItem.Navigation.PushAsync({desired_content});

By pushing onto the CurrentItem's Navigation the content within a tab can be updated, and will persist while the user navigates between bottom-bar tabs.

于 2020-05-21T11:37:48.953 回答