删除Xamarin的Humberger菜单中的“自动生成”按钮。使用Shell.FlyoutHeader形成Shell

删除Xamarin的Humberger菜单中的“自动生成”按钮。使用Shell.FlyoutHeader形成Shell,shell,xamarin,Shell,Xamarin,我已经开始学习Xamarin的Shell。我已经使用Shell创建了我的第一个应用程序,并添加了示例主页。在我的AppShell页面中,我添加了一个Shell,并且Shell.FlyoutHeader仅包含boxview。当我运行应用程序并单击Humberger菜单时,有一个额外的按钮或标签(我不确定)没有包含在我的弹出式标题页中。请帮我卸下那个额外的按钮。谢谢 外壳代码: <Shell xmlns="http://xamarin.com/schemas/2014/forms"

我已经开始学习Xamarin的Shell。我已经使用Shell创建了我的第一个应用程序,并添加了示例主页。在我的AppShell页面中,我添加了一个Shell,并且Shell.FlyoutHeader仅包含boxview。当我运行应用程序并单击Humberger菜单时,有一个额外的按钮或标签(我不确定)没有包含在我的弹出式标题页中。请帮我卸下那个额外的按钮。谢谢

外壳代码:

<Shell xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="XamShell.Views.ListOfProductsPage"
             Visual="Material"
             xmlns:local="clr-namespace:XamShell.Views"
             FlyoutBehavior="Flyout"
             xmlns:controls="clr-namespace:XamShell.Controls"             
             Routing.Route="ProductList">

    <Shell.FlyoutHeader>
        <controls:FlyoutHeader/>
    </Shell.FlyoutHeader>

    <local:HomePage />
</Shell>

FlyoutHeader
<Grid BackgroundColor="White">
        <BoxView
               BackgroundColor="Yellow" 
               Opacity="0.6" />
        <Label Text="Animals" 
               TextColor="Red" 
               FontAttributes="Bold" 
               HorizontalTextAlignment="Center"
               VerticalTextAlignment="Center" />
    </Grid>

飞出式收割台

您是否希望达到如下效果

如果是这样,首先请参考此屏幕截图

如果要删除这些按钮,请确保您的
AppShell.xaml
AppShell.xaml.cs
文件不包含类似此链接的
弹出项和

但我建议你创建一个新项目

创建一个新的shell文件,如下面的代码所示

MainPage.xaml

  <?xml version="1.0" encoding="utf-8" ?>
  <Shell xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:local="clr-namespace:SearchListDemo"
         xmlns:controls="clr-namespace:SearchListDemo.Controls"

   Navigating="OnNavigating"
   Navigated="OnNavigated"
   x:Class="SearchListDemo.MainPage">

<Shell.FlyoutHeader>
    <controls:FlyoutHeader/>
</Shell.FlyoutHeader>

<local:HomePage/>

</Shell>

MainPage.xaml.cs

     [DesignTimeVisible(true)]
public partial class MainPage : Shell
{
    public Dictionary<string, Type> Routes { get { return routes; } }
    Dictionary<string, Type> routes = new Dictionary<string, Type>();
    public MainPage()
    {
       InitializeComponent();

        RegisterRoutes();


    }

    void RegisterRoutes()
    {
        routes.Add("homwpage", typeof(HomePage));


        foreach (var item in routes)
        {
            Routing.RegisterRoute(item.Key, item.Value);
        }
    }
    void OnNavigating(object sender, ShellNavigatingEventArgs e)
    {

    }

    void OnNavigated(object sender, ShellNavigatedEventArgs e)
    {
    }

}
[DesignTimeVisible(true)]
公共部分类主页面:Shell
{
公共字典路由{get{return Routes;}}
字典路由=新字典();
公共主页()
{
初始化组件();
注册表项();
}
无效注册表项()
{
添加(“homwpage”,类型(主页));
foreach(路由中的var项)
{
路由.RegisterRoute(item.Key,item.Value);
}
}
导航时无效(对象发送方,ShellNavigatingEventArgs e)
{
}
已导航无效(对象发送方,ShellNavigatedEventArgs e)
{
}
}
在MainActivity.cs中的
Xamarin.Forms.Forms.Init(e)
之前注册
SetFlag


Xamarin.Forms.Forms.SetFlags(“Shell_实验”)

有人也想实现这一点。请参阅链接。谢谢,请附上一个屏幕截图,说明problem@Jason感谢您的评论,请查看此链接。我还不允许上传图片。谢谢你想移除按钮吗?@BrunoCaceiro是的!我想自定义我的弹出项目感谢回复。我尝试了你的代码,但按钮仍然存在,它只删除了按钮名称。你是否重新创建了一个新项目来添加我的上述代码?或者你可以上传你的演示,我可以帮你解决这个问题。用户想删除他原来的整个按钮,所以他没有要求弹出菜单