How to increase the font size of the date that is selected on a CalendarDatePicker

时光毁灭记忆、已成空白 提交于 2019-12-01 14:16:49

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:

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

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" />

You can use the Visual Tree Extensions from the UWP Community Toolkit to grab the textbox control by name or type and modify its FontSize property:

 <CalendarDatePicker x:Name="Calender"/>

-

 Calender.FindDescendantByName("DateText").FontSize = 30;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!