Creating a third column in PropertyGrid

5 posts, 0 answers
  1. Sri
    Sri avatar
    5 posts
    Member since:
    Mar 2014

    Posted 01 May 2014 Link to this post

    Is it possible to create a third column in a PropertyGrid?  For example:  PropertyName - PropertyValue - Units of Measure  (ie: "Starting Length" - "1000" - "meters" or "Base Pressure" - "22" - "psi")

    I'm guessing that I might need to create a custom PropertyGrid control that descends from RadPropertyGrid with the third column, and then maybe a custom PropertyStoreItem that includes a field for the third column value (in this case the units of measure).  And then somehow bind it all together.

    I am new to Telerik, and do not have any experience with your Telerik Presentation Framework.

    Thank you.
  2. Peter
    Peter avatar
    1148 posts

    Posted 02 May 2014 Link to this post

    Hi Sri,

    Thank you for your question.

    I would like start with clarification that RadPropertyGrid is not designed to support more than two columns out of the box and I am not able to propose а solution for this which will be applicable in your scenario.

    Instead I would like to suggest to create a custom CustomPropertyGridItemElement which contains a label that displays a third value. This value cannot be bindable and you should set it manually depending on the name or the type of the item. For example:
           this.radPropertyGrid1.CreateItemElement += new CreatePropertyGridItemElementEventHandler(radPropertyGrid1_CreateItemElement);
            this.radPropertyGrid1.EditorInitialized += radPropertyGrid1_EditorInitialized;
            this.radPropertyGrid1.Edited += radPropertyGrid1_Edited;
        void radPropertyGrid1_Edited(object sender, PropertyGridItemEditedEventArgs e)
            RadElement editor = ((PropertyGridTextBoxEditor)(this.radPropertyGrid1.ActiveEditor)).EditorElement;
            editor.MaxSize = new Size(0,0);
        void radPropertyGrid1_EditorInitialized(object sender, PropertyGridItemEditorInitializedEventArgs e)
            RadElement editor = ((PropertyGridTextBoxEditor)(this.radPropertyGrid1.ActiveEditor)).EditorElement;           
            editor.MaxSize = new Size(editor.Size.Width - 25, editor.Size.Height);
            editor.Alignment = System.Drawing.ContentAlignment.MiddleLeft;
    class CustomPropertyGridItemElement : PropertyGridItemElement
        RadLabelElement label;
        protected override void CreateChildElements()
            this.label = new RadLabelElement();
            this.label.Text = "";          
            this.label.StretchHorizontally = false;
            this.label.Margin = new Padding(0, 2, 0, 2);
            this.label.Alignment = System.Drawing.ContentAlignment.MiddleRight;
        public override void Synchronize()
            //check this          
            //if (((Telerik.WinControls.UI.PropertyGridItem)(((Telerik.WinControls.UI.PropertyGridItemElement)(this)).Data)).Accessor).PropertyType == typeof(string))
            if (this.TextElement.Text == "CommonText")
                this.label.Text = "kg";
                this.label.Text = "ml";
        protected override Type ThemeEffectiveType
                return typeof(PropertyGridItemElement);

    Please, refer to the attached sample solution that demonstrates this approach.

    I hope this will be applicable for your scenario.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
  3. Guillaume
    Guillaume avatar
    2 posts
    Member since:
    Oct 2015

    Posted 02 Aug 2016 Link to this post

    Hi there,


    Just want to know if it's now possible to add a third column?

    I want to show some kind of history like this:

    Propertydefinitions | Old values (with nested properties) | New values (with nested properties)


  4. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    3369 posts

    Posted 03 Aug 2016 Link to this post

    Hello Guillaume,

    Thank you for writing. 

    RadPropertyGrid is not designed to support three or more columns. Hence, in order to add some additional information, the possible solution is to create a custom PropertyGridItemElement. A sample approach is demonstrated in Peter's reply. Feel free to modify it in a way which suits your requirement best.

    The following help article demonstrates a sample approach as well:

    I hope this information helps. Should you have further questions I would be glad to help.

    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  5. Guillaume
    Guillaume avatar
    2 posts
    Member since:
    Oct 2015

    Posted 03 Aug 2016 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hello Dess,

    Thank you for your reply. I'll use the GridView instead, it should be easier and more stable than to tweak the PropertyGrid particularly when I don't really need the other functionalities :)

    Thanks again!

Back to Top