ClassDocumentElementCollectionBase<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:
public abstract class DocumentElementCollectionBase<T, TOwner> : IEnumerable
Inheritance: objectDocumentElementCollectionBase<T, TOwner>
Derived Classes:
Implements:
Properties
Count
The current number of elements in the collection, reflecting the document hierarchy state.
Declaration
public int Count { get; }
Property Value
The number of elements contained in the collection.
Owner
Gets the element holding the collection.
Declaration
protected TOwner Owner { get; }
Property Value
TOwner
The owner element.
Methods
Add(T)
Adds an item to the collection.
Declaration
public void Add(T item)
Parameters
item
T
The element to add to the collection.
Contains(T)
Determines whether the collection contains a specific element.
Declaration
public bool Contains(T item)
Parameters
item
T
The element to locate in the collection.
Returns
true if item is found in the collection; otherwise, false.
CopyTo(T[], int)
Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
array
T[]
The array.
arrayIndex
Index of the array.
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
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
public int IndexOf(T item)
Parameters
item
T
The element to locate in the collection.
Returns
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
public void Insert(int index, T item)
Parameters
index
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
public void InsertRange(int index, IEnumerable<T> items)
Parameters
index
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
protected virtual void OnAfterAdd(T item)
Parameters
item
T
The element.
OnAfterRemove(T)
Called when the element is removed.
Declaration
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
public bool Remove(T item)
Parameters
item
T
The object to remove from the collection.
Returns
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
public void RemoveAt(int index)
Parameters
index
The zero-based index of the item to remove.
RemoveRange(int, int)
Removes the range.
SetParent(T, TOwner)
Sets the parent of the document element.
Declaration
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
protected abstract void VerifyDocumentElementOnInsert(T item)
Parameters
item
T
The item.