New to Telerik UI for WinForms? Start a free 30-day trial

Provides a typed view over a document element's children, applying child validation and raising collection notifications.

Definition

Namespace:Telerik.WinForms.Documents.Model

Assembly:Telerik.WinControls.RichTextEditor.dll

Type Parameters:

TInheritor

Syntax:

C#
public abstract class SpecializedDocumentElementCollection<TInheritor> : IList, ICollection, IEnumerable where TInheritor : DocumentElement

Inheritance: objectSpecializedDocumentElementCollection<TInheritor>

Derived Classes: BlockCollectionInlineCollectionParagraphCollectionSectionCollectionTableCellCollectionTableRowCollection...

Implements: ICollectionIEnumerableIList

Properties

Gets the number of child elements in the wrapped collection.

C#
public int Count { get; }

First

TInheritor

Gets the first child of this collection, or null when the collection is empty.

C#
public TInheritor First { get; }

Gets the backing document-element collection for operations not exposed by the typed collection wrapper.

C#
protected DocumentElementCollection InnerCollection { get; }

Gets whether the wrapped collection is read-only. The wrapped collection does not implement IList, so this cast cannot succeed.

C#
public bool IsReadOnly { get; }
Exceptions: InvalidCastException

The wrapped collection is cast to IList.

Last

TInheritor

Gets the last child of this collection, or null when the collection is empty.

C#
public TInheritor Last { get; }

Methods

Adds a DocumentElement to the collection.

C#
public void Add(TInheritor item)
Parameters:itemTInheritor

The object to add to the ICollection<T>.

Inserts a new child immediately after an existing child.

C#
public void AddAfter(TInheritor item, TInheritor newItem)
Parameters:itemTInheritor

The existing child that will precede the inserted element.

newItemTInheritor

The child to insert.

Inserts a new child immediately before an existing child.

C#
public void AddBefore(TInheritor item, TInheritor newItem)
Parameters:itemTInheritor

The existing child that will follow the inserted element.

newItemTInheritor

The child to insert.

Adds each element in the sequence through Add(TInheritor). Child validation and collection notifications therefore occur for each element.

C#
public void AddRange(IEnumerable<TInheritor> range)
Parameters:rangeIEnumerable<TInheritor>

The elements to add in enumeration order.

Removes all child elements from the wrapped collection and raises CollectionChanged.

C#
public void Clear()

Checks whether the wrapped collection contains an element. The wrapped implementation does not support this operation.

C#
public bool Contains(TInheritor item)
Parameters:itemTInheritor

The element to locate.

Returns:

bool

This method does not return.

Exceptions: NotImplementedException

The wrapped collection's Contains(DocumentElement) method is called.

Copies the collection's elements to an array, beginning at the specified array index.

C#
public void CopyTo(TInheritor[] array, int arrayIndex)
Parameters:arrayTInheritor[]

The destination array.

arrayIndexint

The zero-based destination index at which copying begins.

Detaches an element from the wrapped collection without raising CollectionChanged.

C#
public bool Detach(TInheritor item)
Parameters:itemTInheritor

The element to detach.

Returns:

bool

true if the element was detached; otherwise, false.

Returns an enumerator over the typed child elements.

C#
public IEnumerator<TInheritor> GetEnumerator()
Returns:

IEnumerator<TInheritor>

An enumerator that yields the collection's child elements.

Called when the collection is changed. Raises CollectionChanged event.

C#
protected virtual void OnCollectionChanged()

Called when DocumentElement is added.

C#
protected virtual void OnElementAdded(DocumentElement element)
Parameters:elementDocumentElement

The element.

Removes an element from the wrapped collection and raises CollectionChanged when removal succeeds.

C#
public bool Remove(TInheritor item)
Parameters:itemTInheritor

The element to remove.

Returns:

bool

true if the element was removed; otherwise, false.

Converts the collection to an array.

C#
public TInheritor[] ToArray()
Returns:

TInheritor[]

An array of DocumentElements.

Provides a hook for derived collections to enforce additional rules before a child is added.

C#
protected virtual void VerifyChildrenOverride(TInheritor item)
Parameters:itemTInheritor

The child element being validated.

Events

Occurs when the collection is changed.

C#
public event EventHandler CollectionChanged

Occurs when a DocumentElement is added.

C#
public event EventHandler<ElementAddedEventArgs> ElementAdded