Can't inherit from CollectionEditor

rbulph

Junior Contributor
Joined
Feb 17, 2003
Messages
397
I want to use the PropertyGrid with a collection of my own types of objects. I want to give the user the option to choose from a number of pre-existing objects which he can add to the collection through the Collection Editor.

I believe that the first thing I need to do is create a class inheriting from the CollectionEditor. But I can't seem to inherit from this. It's System.ComponentModel.Design.CollectionEditor right? It shows up in the Object Browser but doesn't seem to be recognised when I'm writing code at all. I'm probably missing something obvious, but any thoughts as to why this might be?

Thanks.
 
OK, seems I can fix it by adding a project reference to System.Design.dll

But I'm confused. CollectionEditor is under the Namespace System.ComponentModel.Design, which presumably is within System.Design.dll. If I don't have a reference to System.Design.dll I can still refer to various System.ComponentModel.Design classes (like DesignerOptionService). What's the logic behind this?
 
Thanks, I guess that must be right.

Would still be grateful for any direction as to how I can use the CollectionEditor to allow inclusion of items from a pre-existing collection rather than simply creating new ones.
 
Hmm, perhaps it would be easier to create my own form and inherit UITypeEditor in a class to handle this.
 
Back
Top