Approved
Last Updated: 12 Jul 2017 08:15 by ADMIN
ADMIN
Dimitar
Created on: 21 Jun 2017 11:34
Category: Editors
Type: Bug Report
2
FIX. RadDateTimePicker - exception when using FreeFormDateTimeProvider and pressing RightArrow key.
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);
        }
    }
}
0 comments