I've got some weird custom logic to implement on a text field, for which the best solution seems to be a Custom Editor using a RadDropDownListEditorElement. I want the Enter key to commit the current selection and end editing. The default behavior when Enter is pressed is to close the Popup, but leave the editor focused in edit mode.
I tried the following (inside the Custom Editor class I defined):
radDropDownListEditorElement.KeyDown += (o, args) =>
if
(args.KeyCode == Keys.Enter)
{
var cell = parentGridView.CurrentCell;
parentGridView.EndEdit();
cell.ViewInfo.Refresh();
}
};
This works fine if the popup is already closed (for example, by pressing Enter twice, or clicking the mouse and THEN pressing Enter). But when the popup is open, KeyDown never gets fired. I've tried capturing radDropDownListEditorElement.Popup.KeyDown and PopupForm.KeyDown, with no luck. Any idea how to get keypresses when the Popup is open, or a better way to achieve this functionality? Using a Custom Editor is required for other reasons.