Search code examples
xamarinnavigation

Xamarin NavigationPage for some pages not all


I saw a lot apps that their first page doesn't have NavigationPage bar but rest pages have. I wanna know how to do it.


Solution

  • You can use the NavigationPage.HasNavigationBar="false" in the first page in your project. Such as:

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

    The default value of is true, so the rest page will have the NavigationBar.

    You can also do this in the page.cs with the code NavigationPage.SetHasNavigationBar(this, false);