简体   繁体   English

如何在 Flyout 上隐藏 Shell 项目

[英]How to hide Shell Item on Flyout

I have a Xamarin Forms project in which I have a ShellItem login and then it shows me a FlyoutItem main with different tabs.我有一个 Xamarin Forms 项目,其中我有一个 ShellItem login名,然后它显示了一个带有不同选项卡的 FlyoutItem main

Here is the code on my AppShell这是我的AppShell上的代码

<ShellItem Route="login" x:Name="loginItem">
        <ShellContent ContentTemplate="{DataTemplate local:LoginPage}"/>
    </ShellItem>

    <FlyoutItem Title="Home" Route="main" Icon="homepage.png" >
        
            <Tab Icon="search.png">
                <ShellContent  ContentTemplate="{DataTemplate local:CategoryPage}" />
            </Tab>
            <Tab Route="CartPage" Icon="shopping_cart.png">
                <ShellContent  ContentTemplate="{DataTemplate local:CartPage}" />
            </Tab>
            <Tab Route="InvoicePage" Icon="invoice.png">
                <ShellContent  ContentTemplate="{DataTemplate local:InvoicePage}" />
            </Tab>
       
    </FlyoutItem>

    <FlyoutItem Title="Información" Icon="information.png">
        <ShellContent  ContentTemplate="{DataTemplate local:InfoPage}" />
    </FlyoutItem>

    <FlyoutItem Title="Contacto" Icon="contact.png">
        <ShellContent  ContentTemplate="{DataTemplate local:ContactSupportPage}" />
    </FlyoutItem>

Here is the login page, as you can see I don't want to display the flyout item yet.这是登录页面,如您所见,我还不想显示弹出项。

在此处输入图像描述

The issue is on my FlyoutItem "main".问题出在我的 FlyoutItem“main”上。 If the user accidentally presses the blank space above "Home" it will take them to the login page which I don't want to happen.如果用户不小心按下了“主页”上方的空白区域,他们将被带到我不想发生的登录页面。

在此处输入图像描述

在此处输入图像描述

Is there any way of hiding that FlyoutItem?有什么方法可以隐藏 FlyoutItem 吗? I thought it wouldn't show as I have not added it as a FlyoutItem to my AppShell.我认为它不会显示,因为我没有将它作为 FlyoutItem 添加到我的 AppShell。

Please help and thanks.请帮助并感谢。

You can try this.你可以试试这个。

<ShellItem Route="login" x:Name="loginItem" FlyoutItemIsVisible="False" >
    <ShellContent ContentTemplate="{DataTemplate local:LoginPage}"/>
</ShellItem>

Docs:文档:

https://learn.microsoft.com/nl-nl/xamarin/xamarin.forms/app-fundamentals/shell/flyout#flyoutitem-visibility https://learn.microsoft.com/nl-nl/xamarin/xamarin.forms/app-fundamentals/shell/flyout#flyoutitem-visibility

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM