简体   繁体   English

导航栏无法隐藏 xamarin forms

[英]navigation bar can't hide xamarin forms

this my DetailsPage这是我的详细信息页面

public DetailsPage(Property property) {公共详细信息页面(属性属性){

        Xamarin.Forms.NavigationPage.SetHasNavigationBar(this, false);
        Xamarin.Forms.NavigationPage.SetHasBackButton(this, false);
        InitializeComponent();
     
        this.Property = property;
        this.BindingContext = this;
              }

and in my XAML code, I have added these lines在我的 XAML 代码中,我添加了这些行

NavigationPage.HasNavigationBar="False" NavigationPage.HasBackButton="False" NavigationPage.HasNavigationBar="False" NavigationPage.HasBackButton="False"

but can't hide the navigation bar in detailspage但无法隐藏详细信息页面中的导航栏

I have noticed that doing this on your customized base page or just basically on the XAML works better than doing it in code where you might, unknowingly change it in the wrong place do what I do is this我注意到在您的自定义基本页面上或基本上在 XAML 上执行此操作比在您可能的代码中执行此操作更好,在不知不觉中将其更改在错误的位置做我所做的就是这样

<ContentPage
x:Class="Proj.BaseContentPage"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
NavigationPage.HasBackButton="False"
NavigationPage.HasNavigationBar="False">

Goodluck feel free to get back if you have questions如果您有任何问题,Goodluck 随时回复

this is my content page这是我的内容页面

 <ContentPage 

               
xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="App6.DetailsPage"     
             NavigationPage.HasBackButton="False"
             NavigationPage.HasNavigationBar="False"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:pv="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView"
         >

and this is my InitializeComponent();这是我的 InitializeComponent();

   public DetailsPage(Property property)
    {
        Xamarin.Forms.NavigationPage.SetHasNavigationBar(this, false);
        Xamarin.Forms.NavigationPage.SetHasBackButton(this, false);
        InitializeComponent();
       
        this.Property = property;
        this.BindingContext = this;
        //idds = property.Id.ToString();
        //idd = Property.Id.ToString();
        //alert( idd);
    }

but my navigation panel doesn't was hidden但我的导航面板没有被隐藏

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

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