Reputation: 27
I have used a red icon on a Toolbar
, but it still remains in color blue it's like by default. How can i change it to color red.
because initially the icon's color is originally red.
How can i tackle this please.
Below is the image :
and this is Xaml Code :
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Icon ="nav_icon.png" Title="Ea "
x:Class="EAMobileDirectory.MasterPage">
<StackLayout>
<Image Source="featured_newline_1.png" Margin="0,1,0,0"/>
<ListView x:Name="listView" Margin="0,10,0,0" VerticalOptions="FillAndExpand" SeparatorVisibility="None">
<ListView.ItemTemplate>
<DataTemplate>
<ImageCell Text="{Binding Title}" ImageSource="{Binding IconSource}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>
I have also Changed My AppDelegate.cs File According @Steven below is my code i changed:
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
UIToolbar.Appearance.TintColor = UIColor.Red;
UIToolbar.Appearance.BarTintColor = UIColor.Green;
return base.FinishedLaunching(app, options);
}
}
Upvotes: 1
Views: 4775
Reputation: 2981
This is due to the TintColor
property taking over on iOS. It enables you to provide images in every color you want and using TintColor
you can color them in any color. To change this try adding this lines in your AppDelegate.cs
:
UINavigationBar.Appearance.TintColor = UIColor.Red;
This will style the icons for each UINavigationBar in the app.
Upvotes: 10