I\'m building a Xamarin cross-platform App!
The problem is I want to change the colour of NavigationBar
of MainPage
which is MasterPage
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.
The NavigationPage has a BarBackgroundColor property which you can set.
Referred this
var nav = new NavigationPage(new ContentPage { Title = "Page" } );
nav.BarBackgroundColor = Color.Blue;