.NET Framework Class Library
CollectionEditor Class

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

Inheritance Hierarchy
SystemObject
   System.Drawing.DesignUITypeEditor
    System.ComponentModel.DesignCollectionEditor
      More...

Namespace:   System.ComponentModel.Design
Assembly:  System.Design (in System.Design.dll)
Syntax
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 =  
    class 
        inherit [%$TOPIC/9st6k036_en-us_VS_110_2_0_3_0_0%] 
    end

The CollectionEditor type exposes the following members.

Constructors
  NameDescription
Public method CollectionEditorInitializes a new instance of the CollectionEditor class using the specified collection type.
Top
Properties
  NameDescription
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.
Top
Methods
  NameDescription
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.)
Top
Remarks

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.

Examples

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
   Get 
      Return Icollection
   End Get 
   Set
      Icollection = value
   End Set 
End Property 
Private Icollection As ICollection
[EditorAttribute(typeof(System.ComponentModel.Design.CollectionEditor), typeof(System.Drawing.Design.UITypeEditor))]
public ICollection testCollection
{
    get
    {
        return Icollection;
    }
    set
    {
        Icollection = value;
    }
}
private ICollection Icollection;
public:
   [EditorAttribute(System::ComponentModel::Design::CollectionEditor::typeid,
      System::Drawing::Design::UITypeEditor::typeid)]
   property ICollection^ testCollection 
   {
      ICollection^ get()
      {
         return Icollection;
      }
      void set( ICollection^ value )
      {
         Icollection = value;
      }
   }
private:
   ICollection^ Icollection;
Version Information

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0
Platforms

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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.