Reputation: 36058
I created brand new wpf application and on the MainWindow.xaml I have:
why is it that when I run that application I don't see the same font? The xaml code I have is:
<Window.Resources>
<Style TargetType="{x:Type Window}" >
<Setter Property="FontFamily" Value="Arial Black"/>
</Style>
</Window.Resources>
<StackPanel>
<TextBlock>This is a TextBlock</TextBlock>
<Label>This is a Label</Label>
</StackPanel>
Upvotes: 1
Views: 225
Reputation: 13679
this is a known issue, you may need to set explicit style on window.
define the style in application resources or perhaps merge the same using a resource dictionary
eg
<Style x:Key="myWindowStyle" TargetType="{x:Type Window}" >
<Setter Property="FontFamily" Value="Arial Black"/>
</Style>
use the same as
<Window Style="{StaticResource myWindowStyle}" ... />
if you just want to unify the font in the app then perhaps use TextElement.FontFamily
sample
<Window TextElement.FontFamily="Arial Black" ... />
this will help you apply the same font on all the child elements unless explicitly specified.
Upvotes: 1