Hide Title Bar

When I navigate to a page, it displays a chunky bar with my page title. I don't want to change the colour. I just want to remove the thing. How do I do this?

Tagged:

Answers

  • SebastianKruseSebastianKruse USMember ✭✭✭

    This is only displayed if you use a NavigationPage. So simply built your own navigation or use custom renderers to remove the bar (maybe there is a property on the navigation page for this also).

  • kavitpatel.3330kavitpatel.3330 USMember

    If you are using a NavigationPage then following line will hide your navigation bar.
    NavigationPage.SetHasNavigationBar(this, false);

  • N_BauaN_Baua INMember ✭✭✭✭✭

    With Contant page use the following attribute in place.

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

  • Hi @MelbourneDeveloper ,

    while navigating use
    Navigation.PushModalAsyc(new YourNavigationPage());

    and to get back to previous page without refreshing

    Navigation.PopModalAsync();

    by this way you can avoid default navigation bar.

    let me Know if you have any further doubts.

    ThankYou.

  • MelbourneDeveloperMelbourneDeveloper AUMember ✭✭✭

    @N_Baua said:
    With Contant page use the following attribute in place.

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

    @N_Baua , you are very close on this. I tried what you suggested like this:

    <TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="Adapt.Presentation.XamarinForms.TasksPage"
             xmlns:xiviccontrols="clr-namespace:Adapt.Presentation.XivicControls;assembly=Adapt.Presentation.XamarinForms"
             Title="My Tasks" NavigationPage.HasNavigationBar="False" >
    </TabbedPage>
    

    It changed the area in question by simply removing the title text - but the panel remains.

    Before:

    After:

    Obviously, this is on UWP. This appears to be a bug to me. Rather than hiding the navigation bar (although that seems like a strange name - as it really should be called 'Title Bar'), it just hides the Title text. I want the whole thing gone. How do I make the whole thing disappear?

  • N_BauaN_Baua INMember ✭✭✭✭✭
    edited June 2017

    Hi @MelbourneDeveloper ,

    I think you're right,
    https://bugzilla.xamarin.com/show_bug.cgi?id=51509

    However seems they have work around, I have a really no good hands on UWP projects so really can't comment.
    Better luck with this and hope the above link helps.

    The workaround I am taking about is as under (not sure if this is going to work though - I read this here: https://stackoverflow.com/questions/37549364/xamarin-forms-uwp-hide-title-bar):

    public MainPage() {
    NavigationPage.SetHasNavigationBar(this, false);
    InitializeComponent();
    }

    Regards,
    N Baua

  • MelbourneDeveloperMelbourneDeveloper AUMember ✭✭✭

    Thanks. I tried your suggestion but it did nothing. It didn't even hide the text.

  • sudo255sudo255 Member ✭✭

    @MelbourneDeveloper
    If you add this line NavigationPage.HasNavigationBar="False" into your contentPage tags, it will do the trick.

  • johntsiljohntsil Member ✭✭
    edited June 2018

    I found something really weird about NavigationPage.HasNavigationBar="False" when i set it to my ContentPage.
    The scenario is: I have a page called page1 which has a CarouselViewControl. When i navigate to page2 (pushasync) which has HasNavigationBar="True" everything its going all right. If i navigate from page1 to page3(pushasync) which has HasNavigationBar="False" , i noticed that the event PositionSelected of CarouselViewControl is fired before page3 appear on screen and when i popasync page3 this event fired again !!! I remove HasNavigationBar = False from page3 and this isn't happened anymore. Someone can explain me why ??? (Also if i set HasNavigationBar = False at page3 when i returned to page1 (popasync) and swipe the CarouselViewControl PositionSelected runs 4-5 times !!! )

  • jaspal6015jaspal6015 Member ✭✭

    can you help me how to send image from one phone to another via bluetooth in xamarin android

    after successfull connection between two devices how to send image from one device to another

  • Saraswati_ChandraSaraswati_Chandra USMember ✭✭✭
    edited June 2018

    @jaspal6015 said:
    can you help me how to send image from one phone to another via bluetooth in xamarin android

    after successfull connection between two devices how to send image from one device to another

    @jaspal6015 Create a new thread please!! then only everyone will see your question and help you.
    You are asking a question of different topic here!!

  • mattifergmattiferg Member

    I have been reading this and other pages like it for a while and I have finally found a way around it.
    I do understand that the UWP navigation bar cannot not go away completely because the back button is kept on it and that is usually wanted.
    I have my own back button and my own header, so I just don't want the header bar at all.
    With that in mind I have managed to make it never show.

    The Navigation bar for UWP is defined in the following file:-
    on github.com see /xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.UAP/MasterDetailControlStyle.xaml

    From this file I have copied the style for uwp:MasterDetailControl into the App.Xaml file within my UWP project and then on the line starting <Border x:Name="TopCommandBarArea"… I have set Visibility="Collapsed"
    This completely hides the native UWP component that Xamrin Forms insists on displaying.

    Note that this worked for Xamarin Forms 3.1.0.637273 and the file has been changed in the repo since that release such that the file as it currently appears in master will not work.
    The file I copied from is here:-
    on github.com see /xamarin/Xamarin.Forms/blob/4d5a1f5482eeb43661d0ac972262e09c53e61117/Xamarin.Forms.Platform.UAP/MasterDetailControlStyle.xaml

    please excuse the "links" as I just signed up my well meaning efforts are not allowed to contain links.

  • dapugdapug USMember ✭✭
    edited September 2018

    @mattiferg a very interesting strategy. Hijack the style. :) .

    I tried to use the same approach for TabbedPageStyle, however, for some reason Xamarin.Forms.Platform.UWP.FormsPivot class is internal, and therefore not visible to my app, yet all the other UAP controls referenced in the style are Public. grrrrr.

    More importantly, this is not how we should have to deal with this. MS needs to provide a more elegant (sane) solution. Clearly none of the workarounds mentioned above are the solution either, as all that does is remove the text, not the bar.

    GIVE US OUR REALESTATE BACK! Every pixel counts in mobile apps. Aaack!

  • Including my solution, to get rid of the tool bar completely, in your ProjectName.cs, you should have MainPage = new NagivationPage(new MainPage());
    get rid of it and put in MainPage = new MainPage();

  • FadiHaniFadiHani USMember ✭✭

    @hidingrighthere said:
    Including my solution, to get rid of the tool bar completely, in your ProjectName.cs, you should have MainPage = new NagivationPage(new MainPage());
    get rid of it and put in MainPage = new MainPage();

    That works if you don't need to use Navigation.PushAsync(Page p).. but if you need to navigate this will crash

Sign In or Register to comment.