如何在 Xamarin 窗体中从另一个页面隐藏外壳选项卡?



我正在使用Shell Tabbed Page,它工作正常。但是当我使用

Navigation.PushAsync(new SecondPage());

然后在第二页外壳选项卡中也显示,所以我需要从这个页面隐藏这个外壳。

怎么做?

从Sheel后端cs页面我可以隐藏这个,我也尝试使用消息传递中心隐藏这个,但它不起作用。

在您的页面中添加:

Shell.TabBarIsVisible="False"

下面是一个示例:

ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Shell.TabBarIsVisible="False"
x:Class="Sample.MySamplePage"
Title="TitleTest">
<StackLayout Spacing="20" Padding="15">
<Label Text="Hello Xamarin"/>
</StackLayout>
</ContentPage>

最新更新