Xamarin表单Device.Styles FontFamily

时间:2017-04-13 19:41:25

标签: xamarin xamarin.ios xamarin.android xamarin.forms label

我正在尝试使用内置在Device.Style中的Xamarin来设置Label的字体大小;但是,一旦我应用了样式,我设置的自定义字体系列就被覆盖了。我正在使用" Device.Style"因为我想坚持用户的辅助功能设置。我如何使用Device.Style'但是在全局样式中使用字体系列?在某些情况下,我使用的风格超过40次,所以我不想把它放在标签上。

全球风格

 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") }
                }
            };
        }
    }

0 个答案:

没有答案
相关问题