Unplanned
Last Updated: 15 Aug 2017 10:02 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 20 May 2015 12:48
Category: PropertyGrid
Type: Feature Request
1
ADD. RadPropertyGrid - pressing the Enter key over a bool property should change the check-box value
Workaround:

public class CustomPropertyGrid : RadPropertyGrid
{
    public override string ThemeClassName  
    { 
        get 
        { 
            return typeof(RadPropertyGrid).FullName;  
        }
    }

    protected override PropertyGridElement CreatePropertyGridElement()
    {
        return new CustomPropertyGridElement();
    }
}

public class CustomPropertyGridElement : PropertyGridElement
{
    protected override Type ThemeEffectiveType     
    { 
        get    
        { 
            return typeof(PropertyGridElement);     
        }
    }

    protected override PropertyGridSplitElement CreateSplitElement()
    {
        return new CustomPropertyGridSplitElement();
    }
}

public class CustomPropertyGridSplitElement : PropertyGridSplitElement
{
    protected override Type ThemeEffectiveType     
    { 
        get    
        { 
            return typeof(PropertyGridSplitElement);     
        }
    }

    protected override PropertyGridTableElement CreateTableElement()
    {
        return new CustomPropertyGridTableElement();
    }
}

public class CustomPropertyGridTableElement:PropertyGridTableElement
{
    protected override Type ThemeEffectiveType     
    { 
        get    
        { 
            return typeof(PropertyGridTableElement);     
        }
    }

    public override bool ProcessKeyDown(KeyEventArgs e)
    {
        if (e.KeyData == Keys.Enter && ((PropertyGridItem)this.SelectedGridItem).PropertyType == typeof(bool))
        {
            PropertyGridItem item = this.SelectedGridItem as PropertyGridItem;
            item.Value = !(bool)item.Value;
            return true;
        }
        return base.ProcessKeyDown(e);
    }
}
0 comments