问题
There are lots of articles online about how to embed custom fonts, create font styles and apply them to controls. But how can one override the global application font such that each control uses that font instead of setting the FontFamily property manually for each control. In my case, I do not wish to use a custom font as the global font but a system font such as Tahoma or Calibri.
回答1:
In winrt default Fontfamily for all controls ContentPresenter is Segoe Ui and its key is ContentControlThemeFontFamily.
-*You can change or override fontfamily of button,comboboxitem,listboxitem etc from resourcedictionary because they have template property(contenpresenter or itempresenter)
1) Go to StandardStyles.xaml
2) Add <FontFamily x:Key="ContentControlThemeFontFamily">Tahoma</FontFamily>
in default and Highcontrast resourcedictionary of ThemeDictionaries like below.
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<x:String x:Key="BackButtonGlyph"></x:String>
<x:String x:Key="BackButtonSnappedGlyph"></x:String>
<FontFamily x:Key="ContentControlThemeFontFamily">Tahoma</FontFamily>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<FontFamily x:Key="ContentControlThemeFontFamily">Tahoma</FontFamily>
<x:String x:Key="BackButtonGlyph"></x:String>
<x:String x:Key="BackButtonSnappedGlyph"></x:String>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
But Textblock is not having template property so you can change its property like below
1. First Method
<TextBlock FontFamily="{StaticResource ContentControlThemeFontFamily }" >dfdsfsdf</TextBlock>
2. second method
<Page
x:Class="App3.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App3"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" FontFamily="{StaticResource ContentControlThemeFontFamily}">
<Grid>
<TextBlock>Hello World</TextBlock>
</Grid>
来源:https://stackoverflow.com/questions/23150457/change-global-application-font-in-a-windows-8-1-app