How to change NavBar colour of MasterMainPage in Xamarin

Hashir Malik

I'm building a Xamarin cross-platform App!

The problem is I want to change the colour of NavigationBar of MainPage which is MasterPage with a drawer menu in it.

I tried with this code to change the colour but an extra bar appears on NavBar which I don't Want to.

App.xaml.cs:

  MainPage = new NavigationPage(new MainPage())

        {
            BarBackgroundColor = Color.FromHex("#00477f"),
            BarTextColor = Color.White,
        };

ScreenShots: These Screenshots shows what the problem I'm facing!

https://i.stack.imgur.com/fbXie.png

https://i.stack.imgur.com/vuA1A.png

MilanG

Here, when you assign App.xaml's MainPage, a NavigationPage, it shows it's own NavigationBar. Under the hood, your MasterDetailPage also shows the NavigationBar. Thus, you are viewing two NavigationBars.

Go to your MainPage.xaml.cs backend page and in the Constructor, write the line:

NavigationPage.SetHasNavigationBar(this, false);

Thus, your MainPage.xaml.cs should look like :

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

This will hide the NavigationBar of MasterDetailPage.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to change navbar colour when it's scrolled to a certain position?

How do I change the colour of the text in this navbar in Bootstrap?

Change the NAVBAR colour for bootstrap framework

How to identify the navbar colour in CSS

Change colour navbar header Ionic 2

Change default background colour of Bootstrap Navbar

How to change the colour of nodes?

How to change text colour of links in navbar header AND links in nav pills (in shiny app)?

How do i change the Colour of the link on my Navbar when the correct page is loaded?

Change Xamarin.Forms button clicked colour

change the colour of DatePicker [Xamarin.Forms]

How to get jumbotron colour to also cover navbar

How do I change the accent colour of a Xamarin.Forms UWP application?

How to change the colour of the statusbar in android?

How to change grayscale to colour in python?

How to change the background colour of SKScene?

How to change BottomNavigationBar background colour?

How to Change the Colour of a JLabel and JButton

How to change the colour of the lines in ggplot

DataMaps - How to change the colour of the ocean

How to change the colour of the bar in shiny

How to change username colour in Konsole

How to change the checked colour of the checkbox?

How to change the colour of a header bar

How to change fill colour of verbatimTextOutput

How to change the colour of primfaces Axis?

How to change colour of boxes in a grid

Change text colour with bootstrap-vue navbar item-dropdown

How to change semantic ui icon colour to defined colour in ReactJs?