我的代码风格是abc.xaml.cs:
Style labelHeadingStyle = new Style(typeof(Label))
{
Setters = {
new Setter { Property = Label.TextColorProperty, Value = Color.Black },
new Setter { Property = Label.FontFamilyProperty, Value = Device.OnPlatform (
"SomeFont",
"SomeFont",
@"/Assets/Fonts/SomeFont.ttf#SomeFont"
) },
new Setter { Property = Label.FontAttributesProperty, Value = FontAttributes.Bold },
new Setter { Property = Label.FontSizeProperty, Value = 36 }
}
};
在xaml:
<ResourceDictionary>
<Style x:Key="labelHeadingStyle" TargetType="Label">
<Setter Property="TextColor" Value="Black" />
<Setter Property="FontSize" Value="36" />
<Setter Property="FontFamily" Value="" />
</Style>
</ResourceDictionary>
我如何在xaml中定义FontFamil
,就像我在后面的代码中所做的那样(在C#中)?