Forum Xamarin Xamarin.Forms

Unable to change color on AppBar

I'm only able to partially change the background color of the AppBar.

Specifically, the back button segment on the AppBar doesn't change color.

ContentPage.XAML

<Shell.TitleView>
    <Grid BackgroundColor="White">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <Image Grid.Column="0" Source="icon.png" HorizontalOptions="Start" />

        <Label Grid.Column="1" Grid.ColumnSpan="2"
               Text="My Logo"
               FontSize="Large"
               HorizontalOptions="Start" 
               VerticalOptions="Center" />

        <Image Grid.Column="2" Source="Hambuger.png"  HorizontalOptions="End" Margin="0,0,15,0">
            <Image.GestureRecognizers>
                <TapGestureRecognizer Tapped="Hamburger_Tapped" />
            </Image.GestureRecognizers>
        </Image>
    </Grid>
</Shell.TitleView>

AppShell.XAML

<Shell.Resources>
    <ResourceDictionary>
        <Color x:Key="NavigationPrimary">White</Color>
        <Style x:Key="BaseStyle" TargetType="Element">
            <Setter Property="Shell.BackgroundColor" Value="White" />
            <Setter Property="Shell.ForegroundColor" Value="Black" />
            <Setter Property="Shell.TitleColor"      Value="#7f9c6a" />
            <Setter Property="Shell.DisabledColor"   Value="#B4FFFFFF" />
            <Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
            <Setter Property="Shell.TabBarBackgroundColor" Value="White" />
            <Setter Property="Shell.TabBarForegroundColor" Value="White"/>
            <Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF"/>
            <Setter Property="Shell.TabBarTitleColor"      Value="Red"/>
        </Style>
        <Style TargetType="TabBar" BasedOn="{StaticResource BaseStyle}" />
    </ResourceDictionary>
</Shell.Resources>

I attempted the following:

protected override void OnCreate(Bundle savedInstanceState)
{
    ...
    Window.SetNavigationBarColor(Android.Graphics.Color.White);
    ...
}

enter image description here

Tagged:

Best Answer

Answers

Sign In or Register to comment.