All,
A simple question regarding the Calendar for the RadDateTimePicker using Microsoft WinForms.
The behavior I'm trying to fix is this:
I've put a KeyDown handler on the parent RadDateTimePicker that filters out backspace presses (since we don't want them in that control or any hosted controls in it). This appears to work fine (I can see the handler fire when this control has the focus). The RadDateTimePicker also has a hosted calendar control that can be accessed via a mouse click. When clicking on the UI element to get the popup Calendar, it properly pops up.. but when in the Calendar, if I now press the Backspace key, the Calendar popup disappears (this is the undesirable behavior).
I've tried this type of C# code to override keydown for the popup RadCalendar to get it to ignore Backspaces and it does not appear to work (I'm using exactly the same handler for now since I know it works):
this.m_radDateTimePicker = new Telerik.WinControls.UI.RadDateTimePicker();
//other initialization of the m_radDateTimePicker..
Telerik.WinControls.UI.RadDateTimePickerCalendar calendarBehavior = (this.m_radDateTimePicker.DateTimePickerElement.GetCurrentBehavior() as Telerik.WinControls.UI.RadDateTimePickerCalendar);
Telerik.WinControls.UI.RadCalendar calendar = calendarBehavior.Calendar as Telerik.WinControls.UI.RadCalendar;
Telerik.WinControls.UI.RadCalendarElement calendarElement = calendar.CalendarElement as Telerik.WinControls.UI.RadCalendarElement;
calendarElement.KeyDown += new System.Windows.Forms.KeyEventHandler(this.RadDateTimePicker_KeyDown);
I've tried this also on the RadCalendar (calendar.KeyDown += ...), to no effect. Where should I place KeyHandler to get the popup Calendar to ignore Backspaces?
Thanks for your attention,
Richard