简体   繁体   中英

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

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

<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

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();

   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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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