Object Collection Editor

M

m. pollack.

Hi all,

Is there any information to be had about the "Object
Collection Editor" that appears when you click on a
collection property in the PropertyGrid control? I have a
class that maintains a collection of instances of the same
class, and I would like the user to be able to expand the
nested instances and view their properties.

For example, if I have a class called TestClass that has
three properties: Name, ID, and Children, with Children
being a collection of TestClass instances, is there a way
I can use the PropertyGrid to allow the user to "drill
down" into the properties of the child-collection
instances? The Object Collection Editor seems to represent
each member of a collection simply by calling the object's
ToString() method, so I can only go one level deep. The
PropertyGrid itself will expand nested properties as many
levels down as one likes, but the problem is that the
child collection is created at runtime, so I need to use
an ArrayList. Any thoughts?

Thanks, Malcolm
 
J

Jan Tielens

but the problem is that the
child collection is created at runtime, so I need to use
an ArrayList. Any thoughts?


Why do you need an ArrayList at runtime, couldn't you for example use a
strongly type collection? By doing so, the collection editor will know what
type of objects you want to put in the collection so it will be able to
generate a UI for it.
 
M

m. pollack

Hi Jan,

A good thought! Will the Object Collection Editor in fact
be smart enough to display object properties for members
of a strongly typed collection? That's why I was looking
for some documentation about the editor itself. I suppose
I'll just go ahead and try it. Thanks!

malcolm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top