Reputation: 5
I have a Xamarin forms project, I don't know how to get rid of the default blue in the background. I changed the primary color in the resource dictionary in app.xaml. it works well on the individual pages, but they're still some blue in the background (see screen-shots attached) that I need to change too. thanks heaps in advance
<Application.Resources>
<ResourceDictionary>
<Color x:Key="Primary">BurlyWood</Color>
<Style TargetType="Button">
<Setter Property="BorderRadius" Value="15"/>
<Setter Property="BorderWidth" Value="2"/>
<Setter Property="BorderColor" Value="{StaticResource Primary}"/>
<Setter Property="TextColor" Value="{StaticResource Primary}"></Setter>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="White" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="#332196F3" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
</ResourceDictionary>
</Application.Resources>
Upvotes: 0
Views: 369
Reputation: 155
There are two bar. Navigation bar and Status bar.
For the Navigation Bar add this code inside of ResourceDictionary
tag
<Style TargetType="NavigationPage">
<Setter Property="BarBackgroundColor" Value="White" />
<Setter Property="BarTextColor" Value="Black" />
</Style>
Or, Add this two line inside the constructor of your MainPage.xaml.cs
file
BarBackgroundColor = Color.White;
BarTextColor = Color.Black;
And for the StatusBar follow below link instruction:
Android: Click Here
IoS: Click Here
Upvotes: 1