Class CollectionEditor
Provides a user interface editor that displays a dialog for editing a collection of objects.
public class CollectionEditor : UITypeEditor
- Inheritance
-
CollectionEditor
- Derived
- Inherited Members
Constructors
CollectionEditor(Type)
Initializes a new instance of the CollectionEditor class using the specified collection type.
public CollectionEditor(Type type)
Parameters
type
TypeThe type of the collection for this editor to edit.
Properties
CollectionItemType
Gets the type of the items in the collection.
protected Type CollectionItemType { get; }
Property Value
CollectionType
Gets the type of the collection.
protected Type CollectionType { get; }
Property Value
NewItemTypes
Gets the available types of items that can be created for this collection.
protected Type[] NewItemTypes { get; }
Property Value
- Type[]
Methods
CreateCollectionItemType()
Gets the type of the items in this collection.
protected virtual Type CreateCollectionItemType()
Returns
- Type
The type of of the items in this collection, or object if no
Item
property can be located on the collection.
CreateEditorDialog()
Creates a new dialog to display and edit the current collection.
protected virtual CollectionEditorDialog CreateEditorDialog()
Returns
- CollectionEditorDialog
A CollectionEditorDialog to provide as a user interface for editing the collection.
CreateNewItemTypes()
Gets the available types of items that can be created for this collection.
protected virtual Type[] CreateNewItemTypes()
Returns
- Type[]
An array of types that this collection can contain.
EditValue(ITypeDescriptorContext, IServiceProvider, object)
Edits the specified object's value using the editor style indicated by the GetEditStyle() method.
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
Parameters
context
ITypeDescriptorContextAn ITypeDescriptorContext that can be used to gain additional context information.
provider
IServiceProviderAn IServiceProvider that this editor can use to obtain services.
value
objectThe object to edit.
Returns
- object
The new value of the object. If the value of the object has not changed, this should return the same object it was passed.
GetDisplayText(object)
Retrieves the display text for the specified collection item.
protected virtual string GetDisplayText(object value)
Parameters
value
objectThe collection item for which to retrieve display text.
Returns
- string
The display text for the specified item value.
GetEditStyle(ITypeDescriptorContext)
Gets the editor style used by the EditValue(IServiceProvider, object) method.
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
Parameters
context
ITypeDescriptorContextAn ITypeDescriptorContext that can be used to gain additional context information.
Returns
- UITypeEditorEditStyle
A UITypeEditorEditStyle value that indicates the style of editor used by the EditValue(IServiceProvider, object) method. If the UITypeEditor does not support this method, then GetEditStyle() will return None.
SetItems(object, IEnumerable)
Sets the specified sequence as the items of the collection.
protected virtual void SetItems(object editValue, IEnumerable items)
Parameters
editValue
objectThe collection to edit.
items
IEnumerableA sequence of objects to set as collection items.