I’m using a CheckedListBox as the base for a custom DataGridView cell classes edit mode. I want to close the edit when the user presses the escape key. If the user doesn’t have anything selected overriding OnKeyDown works perfectly. The problem is that if they do OnKeyDown (and OnKeyPressed) aren’t fired by the CheckedListBox; instead the row item deselects itself and eats the event. This means that if the user makes a selection by clicking on any item in the list it takes two presses of escape to close the edit. One to unselect the row they clicked on, and a second to cancel edit mode.
I’m using a CheckedListBox as the base for a custom DataGridView cell classes edit
Share
In order to access the escape key I had to change the behavior of IDataGridViewEditingControl.EditingControlWantsInputKey (equivalent of IsInputKey on normal controls) to pass escape to my OnKeyDown event.