3

For a class that has a collection as one of its fields List<Object> myList, the PropertyGrid would show the value as Collection and launch the Collection Editor when clicked. Is it possible to make that instead an expandable property where each entry would be another expandable property according to whatever fields Object has? Kind of like:

enter image description here

EDIT: The screen is from the project on http://www.codeproject.com/Articles/4448/Customized-display-of-collection-data-in-a-Propert

is there a way I could obtain that "expandable behaviour for a Collection object?

Alex
  • 561
  • 2
  • 9
  • 28
  • 2
    er... since this is clearly the screenshot from the [codeproject article on the same topic](http://www.codeproject.com/Articles/4448/Customized-display-of-collection-data-in-a-Propert), should we assume you're about to self-answer this? – Marc Gravell Nov 06 '12 at 14:12
  • 1
    Well, not quite. The project Uses objects with set fields that are then made into the property's object ("firstName", "Age" ...)... I was hoping to get a pointer on how to get that type of display from a Collection instead. Say I have a collection of 7 "Person" objects and I wanted that property to expand with 7 sub properties for me to edit those "person" objects? – Alex Nov 06 '12 at 14:26
  • which is *exactly* what that article describes. Can you describe the difference a bit more? – Marc Gravell Nov 06 '12 at 14:28
  • Well from what i understand the Objects that are used in that project are not collections but they are each Employee objects. What I wanted to achieve was clicking on "Lara Croft" and seeing the list of all the objects inside the collection that Lara Croft represents? – Alex Nov 06 '12 at 15:07
  • 2
    the bound object is a collection that contains objects, but you can use exactly the same thing down and down and down. You just implement your own custom property expansion for each object in turn. – Marc Gravell Nov 07 '12 at 08:22
  • Thank you. I eventually ended up using one PropertyGrid for the object and a separate Grid on the side for its collections and I make the second grid's object the collection.ToArray(), this gives a nice numbered list of all the objects in the collection selected without the need for separate windows or to create custom objects for each of the collection. – Alex Nov 07 '12 at 10:52

0 Answers0