This is a migrated thread and some comments may be shown as answers.

Activate calendar using keyboard

1 Answer 99 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Cuong
Top achievements
Rank 1
Cuong asked on 21 Apr 2014, 02:57 PM
Hi,

I'm trying to find a way to activate the calendar of a RadDateTimePicker control and show the popup using the keyboard instead of using the mouse.  What I would like is to activate the popup when the user performs a key combination of ctrl+L or ctrl+?.  How would I go about doing this?

1 Answer, 1 is accepted

Sort by
0
Ralitsa
Telerik team
answered on 22 Apr 2014, 10:45 AM
Hello Cuong,

Thank you for contacting us. 

The default shortcut to show the calendar of RadDateTimePicker is functional key F4. If you need to add another shortcut, you can subscribe to KeyDown event and show the calendar. Please take a look at the following code example: 
//subscribe to KeyDown event
this.radDateTimePicker1.KeyDown += radDateTimePicker1_KeyDown;
             
//show calendar
void radDateTimePicker1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.Modifiers == Keys.Control && e.KeyCode == Keys.L)
    {
        RadDateTimePickerCalendar calendarBehavior = this.radDateTimePicker1.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar;
        if (calendarBehavior != null)
        {
            calendarBehavior.ShowDropDown();
        }
    }
}

Should you have further questions, I would be glad to help.

Regards,
Ralitsa
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Cuong
Top achievements
Rank 1
Answers by
Ralitsa
Telerik team
Share this question
or