Reputation: 4779
I need to set (reset) font style to default in some Labels (for instance) when the basic Label style is setup to some specific font family. I.e.:
<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>
There are of course, two other ways: to define all the labels explicitly and use custom renderers, but this is like lots of code.
Upvotes: 3
Views: 4603
Reputation: 2985
The platform default font family can be set with an empty value in the style setter property:
<Style x:Key="defaultLabel" TargetType="Label">
<Setter Property="FontFamily" Value="" />
</Style>
...
<Label x:Name="label" Style="{StaticResource defaultLabel}"
Text="{Binding Source={x:Reference label},
Path=Font, StringFormat='Default: {0}'}}" />
Upvotes: 6