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

Override property value when it shows a namespace

1 Answer 43 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
NorthGates
Top achievements
Rank 1
NorthGates asked on 19 Mar 2013, 04:06 AM
I load classes in a propertygrid that I do not have direct access to change the ToString() displayed when the grid item is a collection.

The problem I have is when the property item is a collection, the value shows the full namespace but I would like to override the text value to something more user friendly.

Some of those collections have sub items and some use UIType editors.

Is it possible?

I tried everything I could think of from pgrid_ItemFormatting and from pgrid_SelectedObjectChanged

1 Answer, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 21 Mar 2013, 03:14 PM
Hi Luc,

Thank you for writing.

You should be able to use the ItemFormatting event of RadPropertyGrid to change the text displayed for any item. Here is a line of code you can use inside the ItemFormatting event handler which would change the text in the value cell:
((PropertyGridItemElement)e.VisualElement).ValueElement.Text = "Collection";
I hope this will help. Feel free to write back with any further questions.

Regards,
Ivan Petrov
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Tags
PropertyGrid
Asked by
NorthGates
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Share this question
or