.NET Framework Class Library
CollectionEditor Class

Provides a user interface that can edit most types of collections at design time.

Inheritance Hierarchy

Namespace:   System.ComponentModel.Design
Assembly:  System.Design (in System.Design.dll)
Public Class CollectionEditor _
	Inherits [%$TOPIC/9st6k036_en-us_VS_110_2_0_0_0_0%]
public class CollectionEditor : [%$TOPIC/9st6k036_en-us_VS_110_2_0_1_0_0%]
public ref class CollectionEditor : public [%$TOPIC/9st6k036_en-us_VS_110_2_0_2_0_0%]
type CollectionEditor =  
        inherit [%$TOPIC/9st6k036_en-us_VS_110_2_0_3_0_0%] 
public class CollectionEditor extends [%$TOPIC/9st6k036_en-us_VS_110_2_0_4_0_0%]

The CollectionEditor type exposes the following members.

Public method CollectionEditorInitializes a new instance of the CollectionEditor class using the specified collection type.
Protected property CollectionItemTypeGets the data type of each item in the collection.
Protected property CollectionTypeGets the data type of the collection object.
Protected property ContextGets a type descriptor that indicates the current context.
Protected property HelpTopicGets the Help keyword to display the Help topic or topic list for when the editor's dialog box Help button or the F1 key is pressed.
Public property IsDropDownResizableGets a value indicating whether drop-down editors should be resizable by the user. (Inherited from UITypeEditor.)
Protected property NewItemTypesGets the available types of items that can be created for this collection.
Protected method CancelChangesCancels changes to the collection.
Protected method CanRemoveInstanceIndicates whether original members of the collection can be removed.
Protected method CanSelectMultipleInstancesIndicates whether multiple collection items can be selected at once.
Protected method CreateCollectionFormCreates a new form to display and edit the current collection.
Protected method CreateCollectionItemTypeGets the data type that this collection contains.
Protected method CreateInstanceCreates a new instance of the specified collection item type.
Protected method CreateNewItemTypesGets the data types that this collection editor can contain.
Protected method DestroyInstanceDestroys the specified instance of the object.
Public method EditValue(IServiceProvider, Object)Edits the value of the specified object using the editor style indicated by the GetEditStyle method. (Inherited from UITypeEditor.)
Public method EditValue(ITypeDescriptorContext, IServiceProvider, Object)Edits the value of the specified object using the specified service provider and context. (Overrides UITypeEditorEditValue(ITypeDescriptorContext, IServiceProvider, Object).)
Public method Equals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Protected method GetDisplayTextRetrieves the display text for the given list item.
Public method GetEditStyleGets the editor style used by the EditValue method. (Inherited from UITypeEditor.)
Public method GetEditStyle(ITypeDescriptorContext)Gets the edit style used by the EditValue method. (Overrides UITypeEditorGetEditStyle(ITypeDescriptorContext).)
Public method GetHashCodeServes as the default hash function. (Inherited from Object.)
Protected method GetItemsGets an array of objects containing the specified collection.
Protected method GetObjectsFromInstanceReturns a list containing the given object
Public method GetPaintValueSupportedIndicates whether this editor supports painting a representation of an object's value. (Inherited from UITypeEditor.)
Public method GetPaintValueSupported(ITypeDescriptorContext)Indicates whether the specified context supports painting a representation of an object's value within the specified context. (Inherited from UITypeEditor.)
Protected method GetServiceGets the requested service, if it is available.
Public method GetTypeGets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public method PaintValue(PaintValueEventArgs)Paints a representation of the value of an object using the specified PaintValueEventArgs. (Inherited from UITypeEditor.)
Public method PaintValue(Object, Graphics, Rectangle)Paints a representation of the value of the specified object to the specified canvas. (Inherited from UITypeEditor.)
Protected method SetItemsSets the specified array as the items of the collection.
Protected method ShowHelpDisplays the default Help topic for the collection editor.
Public method ToStringReturns a string that represents the current object. (Inherited from Object.)

Notes to Inheritors

This editor can edit collections that have an Item property. The editor can determine the type of the collection from the Item property, if it exists. If the collection does not have this property, or if you want to provide collections of more than one type, you can override certain protected members of this class to customize the editor to support other types of collections.


The following code example uses an EditorAttribute to associate the CollectionEditor with a property.

<EditorAttribute(GetType(System.ComponentModel.Design.CollectionEditor), GetType(System.Drawing.Design.UITypeEditor))>  _
Public Property testCollection() As ICollection
      Return Icollection
   End Get 
      Icollection = value
   End Set 
End Property 
Private Icollection As ICollection
[EditorAttribute(typeof(System.ComponentModel.Design.CollectionEditor), typeof(System.Drawing.Design.UITypeEditor))]
public ICollection testCollection
        return Icollection;
        Icollection = value;
private ICollection Icollection;
   property ICollection^ testCollection 
      ICollection^ get()
         return Icollection;
      void set( ICollection^ value )
         Icollection = value;
   ICollection^ Icollection;
Version Information

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.