C# 如何更改默认Xaml文本框字体大小

C# 如何更改默认Xaml文本框字体大小,c#,xaml,formatting,C#,Xaml,Formatting,在my file.xaml中,如何设置TextBlock默认大小,以便不必在TextBlock元素中包含该属性 <UserControl.Resources> <!-- how?/can i set the default font size for textblock element here? --> </UserControl.Resources> <Grid> <StackPanel> <Tex

在my file.xaml中,如何设置TextBlock默认大小,以便不必在TextBlock元素中包含该属性

<UserControl.Resources>
 <!-- how?/can i set the default font size for textblock element here? -->
</UserControl.Resources>

<Grid>
    <StackPanel>
        <TextBlock Text="{Binding HelloWorld}" />
    </StackPanel>
</Grid>

将此内容而不是您的注释放在
UserControl.Resources

<Style TargetType="TextBlock">
    <Setter Property="FontSize" Value="20" />
</Style>