1
votes

I'm newbie at Xamarin Forms. I' ve trouble with NavigationPage BarBackgroundcolor in MasterDetailPage. It doesn't see the same on every page. That's Xamarin Forms Portable project and my code;

<?xml version="1.0" encoding="UTF-8"?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms" 
                  xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
                  xmlns:local="clr-namespace:MasterDetailPageNavigation;assembly=MasterDetailPageNavigation"
                  x:Class="MasterDetailPageNavigation.MainPage">
  <MasterDetailPage.Master>
    <local:MasterPage x:Name="masterPage" BackgroundColor="#fe5722" />
  </MasterDetailPage.Master>
    <MasterDetailPage.Detail>
        <NavigationPage BarBackgroundColor="#fe5722" BarTextColor="White">
            <x:Arguments>
                <local:HomePage />
            </x:Arguments>
        </NavigationPage>
    </MasterDetailPage.Detail>
</MasterDetailPage>

I guess it might be on App page. But how? What can I do to fix that?

2
what is in your MasterDetailPageNavigation?Rohit Vipin Mathews

2 Answers

1
votes

I fix my code with that problem is solved. I set the Barbackgroundcolor on MainPage.xaml.cs

var item = e.SelectedItem as MasterPageItem;
        if (item != null) {
            Detail = new NavigationPage((Page)Activator.CreateInstance(item.TargetType)) 
            { BarTextColor=Color.White,BarBackgroundColor=Color.FromHex("fe5722") };
            masterPage.ListView.SelectedItem = null;
            IsPresented = false;
        }
0
votes

You have to set the BackgroundColor of the Master page to appear in the Navigation Bar. Also it would be good to specify it in in the theme for android so that it gives you a material styling.

There is already plenty of discussion done in the forum.