New to Telerik UI for WPF? Download free 30-day trial


This article provides an information about the following commands that RadDateTimePicker exposes through the RadDateTimePickerCommands static class:

SetToday Command

Using the SetToday command the current date of RadDateTimePicker could be set to the current date (today).

In Example 1 a Button is linked to the RadDateTimePickerCommands.SetToday command after whose execution the date will be set to the current day:

Example 1: SetToday command

<telerik:RadDateTimePicker x:Name="dateTimePicker1" /> 
<telerik:RadButton Command="{x:Static telerik:RadDateTimePickerCommands.SetToday}"  
                   CommandTarget="{Binding ElementName=dateTimePicker1}"  
                   Content="Set Today"/> 

Close Command

The Close command closes the drop down part of RadDateTimePicker if it is opened.

Example 2 demonstrates how to close the drop down of RadDateTimePicker by executing the Close command:

Example 2: Close command

RadDateTimePickerCommands.Close.Execute(null, this.dateTimePicker1); 

See Also

In this article