Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Xamarin Forms Device.Style Overriding FontFamily

I am trying to inherit Device.Styles.["style"] on some of my global Styles. You can find more details here. The problem is that when I set the BaseResourceKey = Device.Style.["style"] my custom font is ignored. How can I use the base resource to use the font sizes, but retain my custom font?

public static Style TitleLabelStyle {
        get {
            return new Style(typeof(Label))
            {
                BaseResourceKey = Device.Styles.TitleStyleKey,
                Setters =
                {
                    new Setter { Property = Label.TextColorProperty, Value = BasicStyle.PrimaryColor },
                    new Setter { Property = Label.FontAttributesProperty, Value = FontAttributes.Bold },
                    new Setter { Property = Label.FontFamilyProperty, Value = Device.OnPlatform("cubano", "cubano.ttf#cubano", "cubano") }
                }
            };****
        }
    }

Answers

Sign In or Register to comment.