Override property value when it shows a namespace

2 posts, 0 answers
  1. NorthGates
    NorthGates avatar
    13 posts
    Member since:
    Oct 2012

    Posted 18 Mar 2013 Link to this post

    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
  2. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 21 Mar 2013 Link to this post

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