This is a migrated thread and some comments may be shown as answers.

Disable the resizing of columns (splitter)

1 Answer 92 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Evy
Top achievements
Rank 1
Evy asked on 15 Jul 2015, 09:01 AM

Hey there,

 

I am browsing the properties/methods of the property grid for a while because I want to disable the resizing of the columns in the property grid.  Something similar to 'AllowVariableSpliterPos'.

Is this supported?
Thanx!

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 Jul 2015, 02:42 PM
Hello Evy,

Thank you for writing.

You can disable columns resizing by inheriting the PropertyGridItemElement or any of its descendants and overriding its OnMouseMove event handler where the basic logic for changing the cursor should not be performed:
public Form1()
{
    InitializeComponent();
    this.radPropertyGrid1.CreateItemElement += radPropertyGrid1_CreateItemElement;
 
    this.radPropertyGrid1.SelectedObject = this;
}
 
private void radPropertyGrid1_CreateItemElement(object sender, CreatePropertyGridItemElementEventArgs e)
{
    if (e.ItemElementType == typeof(PropertyGridItemElement))
    {
        e.ItemElementType = typeof(CustomPropertyGridItemElement);
    }
}
 
public class CustomPropertyGridItemElement : PropertyGridItemElement
{
    protected override Type ThemeEffectiveType    
    {
        get   
        {
            return typeof(PropertyGridItemElement);    
        }
    }
 
    protected override void OnMouseDown(MouseEventArgs e)
    {
        base.OnMouseDown(e);
        this.ElementTree.Control.Cursor = Cursors.Default;
    }
 
    protected override void OnMouseMove(MouseEventArgs e)
    {
    }
}

I hope this information helps. Should you have further questions, I would be glad to help.
 
Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
PropertyGrid
Asked by
Evy
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or