Property Grid, Collection Editor and Generic List

M

ME

I have a property that is a generic list of type IAddress (List<IAddress>).
When I attempt to view this property using the Property Grid control it
plainly says "Collection" and offers the typical generic CollectionEditor
that ships with .NET to edit the property. The trouble comes up though when
I attempt to Add an item to the collection via the CollectionEditor.
Obviously the Collection editor can not create an IAddress object since it
is an interface. I want to be able to supply a constructable type to the
CollectionEditor that it can use instead of the interface when adding an
object to the collection. I am hoping I will not have to create a custom
UITypeEditor.

Is there a way to solve this problem given that I purposely want the
collection to be of type IAddress as it offers greater flexibility down the
road.

Thanks,

Matt
 

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