Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
175
Opening UltraDateTimeEditor using the Enter Key
posted

What is the best way to open the calendar drop-down when the user presses the enter key with focus in the text area?  I know that the DropDown method will open it but I don't know what to check if the user is using the enter key to select the date so that the calendar doesn't stay open.

Parents
No Data
Reply
  • 69832
    Verified Answer
    Offline posted

    Handle KeyDown like so:

    private void ultraDateTimeEditor_KeyDown(object sender, KeyEventArgs e)
    {
        UltraDateTimeEditor control = sender as UltraDateTimeEditor;
        if ( e.KeyCode == Keys.Enter && control.Editor.IsDroppedDown == false )
        {
            control.DropDown();
            e.Handled = true;
        }
    }

Children