Property Grid, Collection Editor and Generic List

  • Thread starter Thread starter ME
  • Start date Start date
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
 
Back
Top