这里面有空间FontSize="28 "
,去掉。
要增加字体大小,您需要为 datepicker 创建自定义样式。
<Style TargetType="dt:DatePicker" x:Name="DatePickerWithLargeFont">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="dt:DatePicker">
<Grid Background="{TemplateBinding Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
</Grid.ColumnDefinitions>
<ComboBox x:Name="DayOptions" FontSize="28"
Margin="0,0,5,0" />
<ComboBox x:Name="MonthOptions" FontSize="28"
Grid.Column="1"
Margin="0,0,5,0" />
<ComboBox x:Name="YearOptions" FontSize="28"
Grid.Column="2" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<dt:DatePicker x:Name="MyDatePicker" Height="50" Width="600" Style="{StaticResource DatePickerWithLargeFont}" />