What Event Should Be Used to Expand an Item

4 posts, 0 answers
  1. Paul
    Paul avatar
    23 posts
    Member since:
    Feb 2013

    Posted 05 Sep 2013 Link to this post

    I couldn't find a property to set that will always expand all property grid items, so now I'm trying to expand just one item when the property grid is loaded. I tried putting the Expand() call in the CreateItem event handler, but the item is always null. If I put the Expand() call in the ItemFormatting event handler, I am unable to collapse the item. Here is the code I'm using:

    PropertyGridItem item = e.Item as PropertyGridItem;

    (item.Label == "abc" && !item.Expanded)
  2. Stefan
    Stefan avatar
    2891 posts

    Posted 10 Sep 2013 Link to this post

    Hello Paul,

    Thank you for writing.

    There is a method that you can call during the OnLoad event of the form to expand all items in RadPropertyGrid:

    This will expand all items in the control and the user will be able to collapsed them if needed.

    I hope that you find this information useful.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Stevens
    Stevens avatar
    1 posts
    Member since:
    Oct 2013

    Posted 24 Sep 2015 in reply to Stefan Link to this post

    Asking How to Expand a single item, not All.
  5. Stefan
    Stefan avatar
    2891 posts

    Posted 25 Sep 2015 Link to this post


    You mentioned that you chouldn't find a way how to expand all the items, so I gave you how to do it.

    To expand single item, the PropertyGridItem type, has Expand method which will expand the item if it is expandable. There is also Expanded property which you can set and which does the same.

    If you want to expand only certain items, you can do that by using the SelectedObjectChanged event. 
    private void RadPropertyGrid1_SelectedObjectChanged(object sender, PropertyGridSelectedObjectChangedEventArgs e)

    Once you assign the SelectedObject property of the control, this event will get triggered, and you will have access to the Items, from where you can expand the desired ones.

    I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

    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
Back to Top