Class UIElementCollection
- Namespace
- GHIElectronics.Endpoint.UI
- Assembly
- GHIElectronics.Endpoint.UI.dll
A UIElementCollection is a ordered collection of UIElements.
public class UIElementCollection : ICollection, IEnumerable
- Inheritance
-
UIElementCollection
- Implements
- Inherited Members
Remarks
A UIElementCollection has implied context affinity. It is a violation to access the collection from a different context than that of the owning Element
This collection is an amalgam of UIElementCollection and UIElementCollection from Avalon
Constructors
UIElementCollection(UIElement)
public UIElementCollection(UIElement owner)
Parameters
ownerUIElement
Properties
Capacity
Gets or sets the number of elements that the UIElementCollection can contain.
public virtual int Capacity { get; set; }
Property Value
- int
The number of elements that the UIElementCollection can contain.
Remarks
Capacity is the number of elements that the UIElementCollection is capable of storing. Count is the number of UIElements that are actually in the UIElementCollection.
Capacity is always greater than or equal to Count. If Count exceeds Capacity while adding elements, the capacity of the UIElementCollection is increased.
By default the capacity is 0.
Exceptions
- ArgumentOutOfRangeException
Capacity is set to a value that is less than Count.
Count
Gets the number of elements contained in the ICollection.
public virtual int Count { get; }
Property Value
- int
The number of elements contained in the ICollection.
IsSynchronized
Gets a value indicating whether access to the ICollection is synchronized (thread safe).
public virtual bool IsSynchronized { get; }
Property Value
- bool
true if access to the ICollection is synchronized (thread safe); otherwise, false.
this[int]
Indexer for the UIElementCollection. Gets or sets the UIElement stored at the zero-based index of the UIElementCollection.
public UIElement this[int index] { get; set; }
Parameters
indexint
Property Value
Remarks
This property provides the ability to access a specific UIElement in the
UIElementCollection by using the following systax: myUIElementCollection[index].
Exceptions
- ArgumentOutOfRangeException
indexis less than zero -or-indexis equal to or greater than Count.- ArgumentException
If the new child has already a parent or if the slot a the specified index is not null.
SyncRoot
Gets an object that can be used to synchronize access to the ICollection.
public virtual object SyncRoot { get; }
Property Value
- object
An object that can be used to synchronize access to the ICollection.
Methods
Add(UIElement)
Appends a UIElement to the end of the UIElementCollection.
public int Add(UIElement element)
Parameters
elementUIElement
Returns
- int
The UIElementCollection index at which the UIElement has been added.
Remarks
Adding a null is allowed.
Exceptions
- ArgumentException
If the new child has already a parent.
Clear()
Removes all elements from the UIElementCollection.
public void Clear()
Remarks
Count is set to zero. Capacity remains unchanged. To reset the capacity of the UIElementCollection, call TrimToSize or set the Capacity property directly.
Contains(UIElement)
Determines whether a element is in the UIElementCollection.
public bool Contains(UIElement element)
Parameters
elementUIElement
Returns
CopyTo(UIElement[], int)
Strongly typed version of CopyTo Copies the collection into the Array.
public virtual void CopyTo(UIElement[] array, int index)
Parameters
CopyTo(Array, int)
Copies the UIElement collection to the specified array starting at the specified index.
public void CopyTo(Array array, int index)
Parameters
IndexOf(UIElement)
Returns the zero-based index of the UIElement. If the UIElement is not in the UIElementCollection -1 is returned. If null is passed to the method, the index of the first entry with null is returned. If there is no null entry -1 is returned.
public int IndexOf(UIElement element)
Parameters
elementUIElement
Returns
Insert(int, UIElement)
Inserts an element into the UIElementCollection at the specified index.
public void Insert(int index, UIElement element)
Parameters
indexintThe zero-based index at which value should be inserted.
elementUIElementThe UIElement to insert.
Remarks
If Count already equals Capacity, the capacity of the UIElementCollection is increased before the new UIElement is inserted.
If index is equal to Count, value is added to the end of UIElementCollection.
The UIElements that follow the insertion point move down to accommodate the new UIElement. The indexes of the UIElements that are moved are also updated.
Exceptions
- ArgumentOutOfRangeException
index is less than zero.
-or-
index is greater than Count.
Remove(UIElement)
Removes the specified element from the UIElementCollection.
public void Remove(UIElement element)
Parameters
elementUIElementThe UIElement to remove from the UIElementCollection.
Remarks
The UIElements that follow the removed UIElements move up to occupy the vacated spot. The indexes of the UIElements that are moved are also updated.
If element is null then the first null entry is removed. Note that removing a null entry is linear in the size of the collection.
RemoveAt(int)
Removes the UIElement at the specified index.
public void RemoveAt(int index)
Parameters
indexintThe zero-based index of the element to remove.
Remarks
The UIElements that follow the removed UIElements move up to occupy the vacated spot. The indexes of the UIElements that are moved are also updated.
Exceptions
- ArgumentOutOfRangeException
index is less than zero - or - index is equal or greater than count.
RemoveRange(int, int)
Removes a range of UIElements from the UIElementCollection.
public void RemoveRange(int index, int count)
Parameters
indexintThe zero-based index of the range of elements to remove
countintThe number of elements to remove.
Remarks
The UIElements that follow the removed UIElements move up to occupy the vacated spot. The indexes of the UIElements that are moved are also updated.
Exceptions
- ArgumentOutOfRangeException
index is less than zero. -or- count is less than zero.
- ArgumentException
index and count do not denote a valid range of elements in the UIElementCollection.