Disable the resizing of columns (splitter)

2 posts, 0 answers
  1. Evy
    Evy avatar
    1 posts
    Member since:
    Jul 2015

    Posted 15 Jul 2015 Link to this post

    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!

     

  2. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 16 Jul 2015 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top