Completed
Last Updated: 18 Oct 2016 09:26 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 06 Oct 2016 12:13
Category: PropertyGrid
Type: Bug Report
10
FIX. RadPropertyGrid - NullReferenceException when using mouse wheel and selecting an item that uses PropertyGridDropDownListEditor
To reproduce: please refer to the attached gif file.

The error is not reproduced each time with the Demo application. Sometimes an unhandled exception dialog appears and sometimes the application becomes unresponsive and you can not close the application with upper right X, the options to the right does not respond, you can not change demo using the list on the left. Selecting "Settings" in Property Grid section and then clicking on a boolean property (left column), scrolling using the mouse wheel, then selecting another property (with PropertyGridDropDownListEditor) or clicking around in the application (even outside of the property grid form).

Workaround:   this.radPropertyGrid1.EditorRequired += radPropertyGrid1_EditorRequired;

private void radPropertyGrid1_EditorRequired(object sender, PropertyGridEditorRequiredEventArgs e)
{
    if (e.EditorType == typeof(PropertyGridDropDownListEditor))
    {
        e.Editor = new CustomPropertyGridDropDownListEditor();
    }
}

public class CustomPropertyGridDropDownListEditor : PropertyGridDropDownListEditor
{
    public override object Value
    {
        get
        {
            PropertyGridItemElement element = this.OwnerElement as PropertyGridItemElement;
            PropertyGridItem item = element.Data as PropertyGridItem;
            if (item == null)
            {
                return null;
            }
            return base.Value;
        }
        set
        {
            base.Value = value;
        }
    }
}
Attached Files:
0 comments