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

Shortcut for DateTimePicker

1 Answer 13 Views
This is a migrated thread and some comments may be shown as answers.
Amin
Top achievements
Rank 1
Amin asked on 25 Feb 2018, 02:50 PM
Hello
Is it possible to set shortcut for TextBox inside DateTimePicker control or any control other than RadButton and RadMenuItem?
I have tried setting shortcut for TextBoxElement in DateTimePicker using:
dtp.DateTimePickerElement.TextBoxElement.Shortcuts.Add(new RadShortcut(Keys.Control, Keys.D));
but it did not work. 

1 Answer, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 Feb 2018, 12:59 PM
Hello, Amin, 

Thank you for writing.  

RadDateTimePicker hosts the standard MS TextBox. It is necessary to add the shortcut to the DateTimePickerElement.TextBoxElement.TextBoxItem.Shortcuts collection: 
public RadForm1()
{
    InitializeComponent();
 
    this.radDateTimePicker1.DateTimePickerElement.TextBoxElement.TextBoxItem.Click+=TextBoxItem_Click;
    this.radDateTimePicker1.DateTimePickerElement.TextBoxElement.TextBoxItem.Shortcuts.Add(new RadShortcut(Keys.Control, Keys.D));
}
 
private void TextBoxItem_Click(object sender, EventArgs e)
{
    Console.WriteLine("aaa");
}

The following help article is quite useful for assigning global shortcuts: https://docs.telerik.com/devtools/winforms/shortcuts/assigning-global-radshortcuts 

I hope this information helps. Should you have further questions I would be glad to help. 
 
 Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Asked by
Amin
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or