Export (0) Print
Expand All

CollectionEditor Class

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

For a list of all members of this type, see CollectionEditor Members.

System.Object
   System.Drawing.Design.UITypeEditor
      System.ComponentModel.Design.CollectionEditor
         System.ComponentModel.Design.ArrayEditor
         System.Web.UI.Design.WebControls.ListItemsCollectionEditor
         System.Web.UI.Design.WebControls.TableCellsCollectionEditor
         System.Web.UI.Design.WebControls.TableRowsCollectionEditor

[Visual Basic]
Public Class CollectionEditor
   Inherits UITypeEditor
[C#]
public class CollectionEditor : UITypeEditor
[C++]
public __gc class CollectionEditor : public UITypeEditor
[JScript]
public class CollectionEditor extends UITypeEditor

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.

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.

Example

[Visual Basic, C#, C++] The following code example uses an EditorAttribute to associate the CollectionEditor with a property.

[Visual Basic] 
<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

[C#] 
[EditorAttribute(typeof(System.ComponentModel.Design.CollectionEditor), typeof(System.Drawing.Design.UITypeEditor))]
public ICollection testCollection
{
    get
    {
        return Icollection;
    }
    set
    {
        Icollection = value;
    }
}
private ICollection Icollection;

[C++] 
public:
    [EditorAttribute(__typeof(System::ComponentModel::Design::CollectionEditor),
        __typeof(System::Drawing::Design::UITypeEditor))]
    __property ICollection* get_testCollection() {
        return Icollection;
    }
    [EditorAttribute(__typeof(System::ComponentModel::Design::CollectionEditor),
        __typeof(System::Drawing::Design::UITypeEditor))]
    __property void set_testCollection(ICollection* value) {
        Icollection = value;
    }
private:
    ICollection*  Icollection;

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.ComponentModel.Design

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System.Design (in System.Design.dll)

See Also

CollectionEditor Members | System.ComponentModel.Design Namespace | UITypeEditor

Show:
© 2014 Microsoft