Use attached project and the following steps:
- When the application starts, use the drop down calendar to select another date.
- Then press Ctrl+A to select the entire content of the editor and press the Del key to clear the content.
- Now press the right arrow key and it crashes with a NullReferenceException inside of the RadDateTimePickerElement.OnKeyDown method.
- This bug only occurs when ShowCheckBox is true.
Workaround:
class MyRadDateTimePicker : RadDateTimePicker
{
protected override RadDateTimePickerElement CreateElement()
{
return new MyRadDateTimePickerElement();
}
}
class MyRadDateTimePickerElement : RadDateTimePickerElement
{
protected override void OnKeyDown(KeyEventArgs e)
{
var provider = this.TextBoxElement.Provider as MaskDateTimeProvider;
if (e.KeyCode == Keys.Right && provider.List != null)
{
base.OnKeyDown(e);
}
}
protected override Type ThemeEffectiveType
{
get
{
return typeof(RadDateTimePickerElement);
}
}
}