Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How can I change the font/text style of UIBarButtonItem

$
0
0

I am trying to change the font of a secondary ToolBarItem in iOS on Xamarin Forms. I have managed to change the font throughout the app on every element except this one. I have tried overriding the ViewWillAppear method on both the custom control renderer and the content page renderer for iOS. I have set the font size and color just for ease of detecting success but had no luck yet.

public override void ViewWillAppear(bool animated)
{
    base.ViewWillAppear(animated);

    var textAttributes = new UITextAttributes()
    {
        TextColor = Color.Red.ToUIColor(),
        Font = UIFont.FromName("OpenSans-Regular", 26)
    };

    UIBarButtonItem.Appearance.SetTitleTextAttributes(textAttributes, UIControlState.Normal);
}

I hit breakpoints when I use this code but nothing seems to change.
I don't see any way to make a custom renderer specifically for the toolbaritems or menuitems. Any tips are much appreciated.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>