DateTimePicker - get value in runtime

1 Answer 478 Views
DatePicker TimePicker
Daniel
Top achievements
Rank 1
Silver
Bronze
Daniel asked on 09 Mar 2022, 08:03 AM

Hi,

How I take the value of DateTimePicker in run time when I press on other button.

Thanks,

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 10 Mar 2022, 10:42 AM

Hi Daniel,

The DatePicker control exposes Date property which you can use to retrieve the selected date - you can bind it to a DateTime? property in the ViewModel or directly take it from the DatePicker instance, for example:

 

 <VerticalStackLayout Padding="10">   
            <telerikInput:RadDatePicker x:Name="datePicker" />
            <telerik:RadButton Text="Get Date" Clicked="button_Clicked" />
</VerticalStackLayout>

 

And the button clicked event handler:

 

private void button_Clicked(object sender, System.EventArgs e)
{
     var selectedDate = datePicker.Date;
}

Let me know if you have any additional questions on this.

Regards,
Yana
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
DatePicker TimePicker
Asked by
Daniel
Top achievements
Rank 1
Silver
Bronze
Answers by
Yana
Telerik team
Share this question
or