想要在FontFamily
中设置全局FontSize
和ResourceDictionary
,但这不是一个选项。为什么呢?
答案 0 :(得分:0)
这对我有用:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App59">
<FontFamily
x:Key="MyFamily">Consolas</FontFamily>
<x:Double
x:Key="MyFontSize">48</x:Double>
</ResourceDictionary>
页
<Page
x:Class="App59.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App59"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary
Source="SomeResourceDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<TextBlock
Text="Hello"
FontSize="{StaticResource MyFontSize}"
FontFamily="{StaticResource MyFamily}"></TextBlock>
</Grid>
</Page>