【发布时间】:2018-08-06 23:28:18
【问题描述】:
当基本标签样式设置为某些特定字体系列时,我需要在某些标签中将字体样式设置(重置)为默认值(例如)。 即:
<Style TargetType="Label">
<Setter Property="FontFamily" Value="{StaticResource ThinFontFamily}" />
</Style>
<Style TargetType="Label" x:Key="MyCustomStyle">
<Setter Property="FontFamily" Value="... to some default"></Setter>
</Style>
当然还有另外两种方法:显式定义所有标签并使用自定义渲染器,但这就像很多代码。
【问题讨论】:
-
不完全。我问(除其他外)关于在 xaml 中使用它。
-
创建自定义标签类。它应该有你的自定义字体,默认标签有默认字体。反之亦然
标签: xaml xamarin.forms styles cross-platform