RadDateTimePicker Gets the selected value

1 Answer 144 Views
TimePicker
li
Top achievements
Rank 1
Iron
li asked on 25 Apr 2022, 09:03 AM

<Grid Grid.Row="0" Grid.Column="1">
                <telerikInput:RadDateTimePicker SpinnerFormat="yyyy-MM-dd HH:mm:ss" x:Name="StarDateTime" BorderColor="#c9c9c9" BorderThickness="1"
                                PlaceholderTemplate="{StaticResource placeholderTemplateStar}"
                                DisplayTemplate="{StaticResource displayTemplate}">
                    <telerikInput:RadDateTimePicker.SelectorSettings>
                        <telerikInput:PickerPopupSelectorSettings HeaderTemplate="{StaticResource headerTemplate}" 
                                                  FooterTemplate="{StaticResource footerTemplate}" />
                    </telerikInput:RadDateTimePicker.SelectorSettings>
                </telerikInput:RadDateTimePicker>
            </Grid>
            <Grid Grid.Row="0" Grid.Column="2">
                <Label VerticalTextAlignment="Center" HorizontalTextAlignment="Center" Text="---" />
            </Grid>
            <Grid Grid.Row="0" Grid.Column="3">
                <telerikInput:RadDateTimePicker SpinnerFormat="yyyy-MM-dd HH:mm:ss" x:Name="EndDateTime" BorderColor="#c9c9c9" BorderThickness="1"
                                PlaceholderTemplate="{StaticResource placeholderTemplateEnd}"
                                DisplayTemplate="{StaticResource displayTemplate}">
                    <telerikInput:RadDateTimePicker.SelectorSettings>
                        <telerikInput:PickerPopupSelectorSettings HeaderTemplate="{StaticResource headerTemplate}" 
                                                  FooterTemplate="{StaticResource footerTemplate}" x:Name="names"/>
                    </telerikInput:RadDateTimePicker.SelectorSettings>
                </telerikInput:RadDateTimePicker>
            </Grid>

 

 

<ControlTemplate x:Key="placeholderTemplateStar">
        <Label Text="请选择开始时间" 
           FontAttributes="Bold" 
           BackgroundColor="White" 
           HeightRequest="50"
           VerticalTextAlignment="Center"
           HorizontalTextAlignment="Center">
            <Label.GestureRecognizers>
                <TapGestureRecognizer Command="{TemplateBinding ToggleCommand}" />
            </Label.GestureRecognizers>
        </Label>
    </ControlTemplate>
    <ControlTemplate x:Key="placeholderTemplateEnd">
        <Label Text="请选择结束时间" 
           FontAttributes="Bold" 
           BackgroundColor="White" 
           HeightRequest="50"
           VerticalTextAlignment="Center"
           HorizontalTextAlignment="Center">
            <Label.GestureRecognizers>
                <TapGestureRecognizer Command="{TemplateBinding ToggleCommand}" x:Name="name" />
            </Label.GestureRecognizers>
        </Label>
    </ControlTemplate>
    <ControlTemplate x:Key="displayTemplate">
        <Label Text="{TemplateBinding DisplayString}" 
           TextColor="White" 
           BackgroundColor="#7BAEFF"
           HeightRequest="50"
           VerticalTextAlignment="Center"
           HorizontalTextAlignment="Center">
            <Label.GestureRecognizers>
                <TapGestureRecognizer Command="{TemplateBinding ToggleCommand}" />
            </Label.GestureRecognizers>
        </Label>
    </ControlTemplate>
    <ControlTemplate x:Key="headerTemplate">
        <Label Text="{TemplateBinding HeaderLabelText}" 
           TextColor="White"
           VerticalTextAlignment="Center"
           HorizontalTextAlignment="Center"
           BackgroundColor="#4488F5"/>
    </ControlTemplate>
    <ControlTemplate x:Key="footerTemplate">
        <StackLayout Orientation="Horizontal" Spacing="0" HorizontalOptions="FillAndExpand" BackgroundColor="#4488F5">
            <Button Text="{TemplateBinding CancelButtonText}" 
                TextColor="White"
                BackgroundColor="Transparent"
                Command="{TemplateBinding CancelCommand}" />
            <Button Text="{TemplateBinding AcceptButtonText}" 
                TextColor="White"
                BackgroundColor="Transparent"
                Command="{TemplateBinding AcceptCommand}" />
        </StackLayout>

    </ControlTemplate>

1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 25 Apr 2022, 10:13 AM

Hi,

You can get the selected DateTime value using the Date property of the RadDateTimePicker. The property is a bindable property and it is of type DateTime?

For more information about DateTimePicker selection check the following help article: https://docs.telerik.com/devtools/xamarin/controls/datetimepicker/datetime-picker-selection 

If this is not the case, please explain in details the scenario you want to achieve.

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
TimePicker
Asked by
li
Top achievements
Rank 1
Iron
Answers by
Didi
Telerik team
Share this question
or