Shortcut for DateTimePicker

2 posts, 1 answers
  1. Amin
    Amin avatar
    1 posts
    Member since:
    Feb 2018

    Posted 25 Feb 2018 Link to this post

    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. 
  2. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4086 posts

    Posted 27 Feb 2018 Link to this post

    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.
Back to Top