Class
DocumentElementCollectionBase<T, TOwner>

Base collection for document model elements that manages ownership, parent links, and insertion validation.

Definition

Namespace:Telerik.Windows.Documents.Core.Data

Assembly:Telerik.Windows.Documents.Core.dll

Type Parameters:

T

The type of the document elements which should be added to the collection.

TOwner

The type of the owner of the collection.

Syntax:

cs-api-definition
public abstract class DocumentElementCollectionBase<T, TOwner> : IEnumerable

Inheritance: objectDocumentElementCollectionBase<T, TOwner>

Derived Classes: DocumentElementCollection<T, TOwner>DocumentElementCollection<T, TOwner>

Implements: IEnumerable

Properties

Count

The current number of elements in the collection, reflecting the document hierarchy state.

Declaration

cs-api-definition
public int Count { get; }

Property Value

int

The number of elements contained in the collection.

Owner

Gets the element holding the collection.

Declaration

cs-api-definition
protected TOwner Owner { get; }

Property Value

TOwner

The owner element.

this[int]

Access or replace the element at the zero‑based index, updating parent links accordingly.

Declaration

cs-api-definition
public T this[int index] { get; set; }

Parameters

index

int

The index.

Property Value

T

Methods

Add(T)

Adds an item to the collection.

Declaration

cs-api-definition
public void Add(T item)

Parameters

item

T

The element to add to the collection.

Clear()

Removes all items from the collection.

Declaration

cs-api-definition
public void Clear()

Contains(T)

Determines whether the collection contains a specific element.

Declaration

cs-api-definition
public bool Contains(T item)

Parameters

item

T

The element to locate in the collection.

Returns

bool

true if item is found in the collection; otherwise, false.

CopyTo(T[], int)

Copies the elements of the collection to an Array, starting at a particular Array index.

Declaration

cs-api-definition
public void CopyTo(T[] array, int arrayIndex)

Parameters

array

T[]

The array.

arrayIndex

int

Index of the array.

GetEnumerator()

Returns an enumerator that iterates through the collection.

Declaration

cs-api-definition
public IEnumerator<T> GetEnumerator()

Returns

IEnumerator<T>

A IEnumerator<T> that can be used to iterate through the collection.

IndexOf(T)

Determines the index of a specific element in the collection.

Declaration

cs-api-definition
public int IndexOf(T item)

Parameters

item

T

The element to locate in the collection.

Returns

int

The index of item if found in the list; otherwise, -1.

Insert(int, T)

Inserts an element to the collection at the specified index.

Declaration

cs-api-definition
public void Insert(int index, T item)

Parameters

index

int

The zero-based index at which item should be inserted.

item

T

The element to insert into the collection.

InsertRange(int, IEnumerable<T>)

Inserts an elements to the collection at the specified index.

Declaration

cs-api-definition
public void InsertRange(int index, IEnumerable<T> items)

Parameters

index

int

The zero-based index at which items should be inserted.

items

IEnumerable<T>

The elements to be inserted into the collection.

OnAfterAdd(T)

Called when the element is added.

Declaration

cs-api-definition
protected virtual void OnAfterAdd(T item)

Parameters

item

T

The element.

OnAfterRemove(T)

Called when the element is removed.

Declaration

cs-api-definition
protected virtual void OnAfterRemove(T item)

Parameters

item

T

The element.

Remove(T)

Removes the first occurrence of a specific object from the collection.

Declaration

cs-api-definition
public bool Remove(T item)

Parameters

item

T

The object to remove from the collection.

Returns

bool

true if item was successfully removed from the collection; otherwise, false. This method also returns false if item is not found in the original ICollection<T>.

RemoveAt(int)

Removes the element at the specified index.

Declaration

cs-api-definition
public void RemoveAt(int index)

Parameters

index

int

The zero-based index of the item to remove.

RemoveRange(int, int)

Removes the range.

Declaration

cs-api-definition
public void RemoveRange(int index, int count)

Parameters

index

int

The zero-based index of the item to remove.

count

int

The number of elements to remove.

SetParent(T, TOwner)

Sets the parent of the document element.

Declaration

cs-api-definition
protected abstract void SetParent(T item, TOwner parent)

Parameters

item

T

The document element.

parent

TOwner

The parent which should be set to the document element.

VerifyDocumentElementOnInsert(T)

Verifies the validity of the document element before it is inserted in the collection.

Declaration

cs-api-definition
protected abstract void VerifyDocumentElementOnInsert(T item)

Parameters

item

T

The item.