Alan2
Alan2

Reputation: 24602

How can I change the color of the font in the Title with Xamarin.Forms?

I am setting a title like this:

 Title = "Card " + index;

and then later in my code I increment index and set it once more:

 Title = "Card " + index;

Is there a way that I can change the color of the title to Gray that will work in both iOS and Android?

Upvotes: 0

Views: 1074

Answers (1)

hvaughan3
hvaughan3

Reputation: 11105

Xamarin Forms Way:

You can use the NavigationPage.BarTextColor for this. Set this property when you initially create the NavigationPage.

iOS Way:

You can also add the following to the your AppDelegate to change the bar text color globally for the iOS side (I usually put them between the Forms.Init() and LoadApplication() lines:

UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.White });

Android Way:

And then you could do it globally in your Android project by applying the correct theme. See this link for an example or that (look for the Style action bar tab text and color color selector part).

Upvotes: 3

Related Questions