I am trying to figure out how to install FontFamily in my App.xaml so that I can declaratively apply this style wherever I need. In ResourceDictionary I can apply something like:
<System:Double x:Key="SmallTextSize">10</System:Double>
What I want to do is something like:
<FontFamily x:Key="MainFont">Wingdings</FontFamily>
But the only thing I can get is an implicit style that requires a target, and a few font declarations that I want to use. I need to be able to apply a style in which I get the FontFamily property of any control.
Here is the closest I can come now:
<System:String x:Key="MainFont">Wingdings</System:String> <Style TargetType="UserControl"> <Setter Property="FontFamily" Value="{StaticResource MainFont}"></Setter> </Style>
This implementation does not work on something like because it expects MainFont to be FontFamily, not a string:
<TextBlock Text="{Binding}" Margin="0,0,0,4" FontWeight="Normal" FontFamily="{StaticResource MainFont}" FontSize="14.667" />
How can I do it? Thanks!
source share