我正在为 WinRT App 使用这个 datePicker 控件。我有以下错误。我需要做些什么来解决它。谢谢
<WinRTDatePicker:DatePicker x:Name="MyDatePicker" Margin="99,203,859,365" FontSize="28 " Grid.Row="1"> </WinRTDatePicker:DatePicker> WinRT 信息:无法从文本“28”创建“Windows.Foundation.Double”。[行:42 位置:92]
我正在为 WinRT App 使用这个 datePicker 控件。我有以下错误。我需要做些什么来解决它。谢谢
<WinRTDatePicker:DatePicker x:Name="MyDatePicker" Margin="99,203,859,365" FontSize="28 " Grid.Row="1"> </WinRTDatePicker:DatePicker> WinRT 信息:无法从文本“28”创建“Windows.Foundation.Double”。[行:42 位置:92]
这里面有空间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}" />