MonthCalendarAdv does not fire keyboard events?

1) I want to be able to override the key bindings of the MonthCalendarAdv control. I tried to handle KeyDown and PreviewKeyDown events, but they do not fire for me?

2) I am having a similar (although milder) problem with a ToolStripComboBox... If I handle KeyDown, it is called for most any key, but not Escape?

I am putting these controls inside a PopupContainerControl, and to the very least want to be able to hide the popup when the user presses Esc.

Thanks,
Kamen

1 Reply

GR Golda Rebecal Syncfusion Team June 11, 2007 02:47 PM UTC

Hi Kamen,

We can handle the KeyDown event in MonthCalendarAdv using the following code.

[Code]
this.monthCalendarAdv1.Controls[0].KeyDown += new KeyEventHandler(monthCalendarAdv1_KeyDown);

// To close the pop up on Esc key
void monthCalendarAdv1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
if (this.popupControlContainer1.IsShowing())
this.popupControlContainer1.HidePopup(PopupCloseType.Canceled);
}

I have attached a sample that illustrates the same. Please have a look at it and let me know if this helps you.

http://websamples.syncfusion.com/samples/Tools.Windows/F62153/Main.htm

Best regards,
Golda

Loader.
Up arrow icon