MilkBottle
MilkBottle

Reputation: 4342

How to use this WinRT DatePicker

I am usig this datePicker control for WinRT App. I have the below error. What I need to do to resolve it. Thanks


 <WinRTDatePicker:DatePicker x:Name="MyDatePicker" Margin="99,203,859,365" FontSize="28 " Grid.Row="1">
</WinRTDatePicker:DatePicker>


WinRT information: Failed to create a 'Windows.Foundation.Double' from the text '28 '. [Line: 42 Position: 92]

Upvotes: 0

Views: 959

Answers (1)

Farhan Ghumra
Farhan Ghumra

Reputation: 15296

There's space in this FontSize="28 ", remove it.

To increase font size you need to create custom style for 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}" />

Upvotes: 1

Related Questions