Table of Contents

Class CollectionEditor

Namespace
Bonsai.Resources.Design
Assembly
Bonsai.System.Design.dll

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 Type

The 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

Type

CollectionType

Gets the type of the collection.

protected Type CollectionType { get; }

Property Value

Type

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 ITypeDescriptorContext

An ITypeDescriptorContext that can be used to gain additional context information.

provider IServiceProvider

An IServiceProvider that this editor can use to obtain services.

value object

The 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 object

The 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 ITypeDescriptorContext

An 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 object

The collection to edit.

items IEnumerable

A sequence of objects to set as collection items.