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> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable
Inheritance: objectDocumentElementCollectionBase<T, TOwner>
Derived Classes:
Implements:
Methods
Adds an item to the collection.
public void Add(T item)
The element to add to the collection.
Implements:
Removes all items from the collection.
public void Clear()
Implements:
Determines whether the collection contains a specific element.
public bool Contains(T item)
The element to locate in the collection.
Returns:true if item is found in the collection; otherwise, false.
Implements:
Returns an enumerator that iterates through the collection.
public IEnumerator<T> GetEnumerator()
IEnumerator<T>
A IEnumerator<T> that can be used to iterate through the collection.
Implements:
Determines the index of a specific element in the collection.
public int IndexOf(T item)
The element to locate in the collection.
Returns:The index of item if found in the list; otherwise, -1.
Implements:
Inserts an element to the collection at the specified index.
public void Insert(int index, T item)
The zero-based index at which item should be inserted.
The element to insert into the collection.
Implements:
Inserts an elements to the collection at the specified index.
public void InsertRange(int index, IEnumerable<T> items)
The zero-based index at which items should be inserted.
The elements to be inserted into the collection.
Called when the element is added.
protected virtual void OnAfterAdd(T item)
The element.
Called when the element is removed.
protected virtual void OnAfterRemove(T item)
The element.
Removes the first occurrence of a specific object from the collection.
public bool Remove(T item)
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>.
Implements:
Removes the element at the specified index.
public void RemoveAt(int index)
The zero-based index of the item to remove.
Implements:
Sets the parent of the document element.
protected abstract void SetParent(T item, TOwner parent)
The document element.
parentTOwnerThe parent which should be set to the document element.
Verifies the validity of the document element before it is inserted in the collection.
protected abstract void VerifyDocumentElementOnInsert(T item)
The item.
Properties
The current number of elements in the collection, reflecting the document hierarchy state.
public int Count { get; }
The number of elements contained in the collection.
Implements:
Owner
TOwner
Gets the element holding the collection.
protected TOwner Owner { get; }
The owner element.