如何增加在 CalendarDatePicker 上选择的日期的字体大小 [英] How to increase the font size of the date that is selected on a CalendarDatePicker
问题描述
我的 UWP 应用上有一个 CalendarDatePicker
控件.我无法增加使用 FontSize
属性选择的日期字体的大小.
I have a CalendarDatePicker
control on my UWP app. I am not able to increase the size of the font of the date that is selected using the FontSize
attribute.
如何在不覆盖大量样式的情况下轻松完成此操作?
这是我的基本代码:
<Page
x:Class="CalendarPickerExample.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:CalendarPickerExample"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<CalendarDatePicker FontSize="30" />
</Grid>
</Page>
无论我在CalendarDatePicker
上设置FontSize
属性是什么大小,所选日期的字体大小都不会增加.
No matter what size I set the FontSize
attribute on the CalendarDatePicker
, the size of the font of the selected date does not increase.
请帮忙!
推荐答案
您可以使用 Live Visual Tree 工具检查控件的属性,如果您想更改内部 TextBlock 的大小:
You can check the properties of the control using Live Visual Tree tool, in your case you want to change the size of the internal TextBlock:
您可以在默认样式的副本中修改 TextBlock 字体大小 https://msdn.microsoft.com/en-us/library/windows/apps/mt299110.aspx
You can modify the TextBlock font size in a copy of the default style https://msdn.microsoft.com/en-us/library/windows/apps/mt299110.aspx
如您所见,默认模板中硬编码为 15:
As you can see, it is hardcoded to 15 in the default template:
<TextBlock x:Name="DateText"
HorizontalAlignment="Left"
Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}"
Text="{TemplateBinding PlaceholderText}"
Grid.Row="1"
FontSize="15"
Padding="12, 0, 0, 2"
VerticalAlignment="Center" />
这篇关于如何增加在 CalendarDatePicker 上选择的日期的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!