Detect if DateTimePicker calendar is opened

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrus

    Detect if DateTimePicker calendar is opened

    I placed DateTimePicker to Winforms DataGridView using sample code from
    MSDN.

    When dropdown calendar is not opened, up and down arrow keys must move
    to previous/next row in grid.
    So I modified EditingControlW antsInputKey() to add check for this using code
    below.

    This causes error

    'CalendarEditin gControl' does not contain a definition for 'DroppedDown' and
    no extension method 'DroppedDown' accepting a first argument of type
    'CalendarEditin gControl' could be found (are you missing a using directive
    or an assembly reference?)

    How to find if calendar opened in EditingControlW antsInputKey ?
    How to allow up and down arrows to move to other row in grid when dropdown
    is closed ?

    Andrus.

    public bool EditingControlW antsInputKey(Ke ys key, bool
    dataGridViewWan tsInputKey) {

    switch (key & Keys.KeyCode) {
    case Keys.Left:
    case Keys.Right:
    case Keys.Home:
    case Keys.End:
    return true;

    case Keys.Prior:
    case Keys.Next:
    case Keys.Up:
    case Keys.Down:
    // next line causes error since DroppedDown property not exists:
    if (this.DroppedDo wn)
    return true;
    break;

    }
    //
    // defer to the DataGridView and see if it wants it.
    //
    return !dataGridViewWa ntsInputKey;

    }


Working...