Skip to main content

UIElementCollection Class

NuGet: GHIElectronics.TinyCLR.UI
Assembly: GHIElectronics.TinyCLR.UI
Namespace: GHIElectronics.TinyCLR.UI

A UIElementCollection is a ordered collection of UIElements.

public class UIElementCollection : ICollection

Constructors

UIElementCollection(UIElement owner)

public UIElementCollection(UIElement owner)

Initializes a new collection owned by the specified element.

Properties

Count

public virtual int Count { get; }

Gets the number of elements in the collection.

IsSynchronized

public virtual bool IsSynchronized { get; }

Gets a value indicating whether access to the collection is thread-safe.

SyncRoot

public virtual object SyncRoot { get; }

Gets an object that can be used to synchronize access to the collection.

Capacity

public virtual int Capacity { get; set; }

Gets or sets the number of elements that the UIElementCollection can contain.

index]

public UIElement this[int index] { get; set; }

Indexer for the UIElementCollection. Gets or sets the UIElement stored at the zero-based index of the UIElementCollection.

Methods

CopyTo(Array array, int index)

public void CopyTo(Array array, int index)

Copies the UIElement collection to the specified array starting at the specified index.

CopyTo(UIElement[] array, int index)

public virtual void CopyTo(UIElement[] array, int index)

Strongly typed version of CopyTo Copies the collection into the Array.

Add(UIElement element)

public int Add(UIElement element)

Appends a UIElement to the end of the UIElementCollection.

Returns int — The UIElementCollection index at which the UIElement has been added.

IndexOf(UIElement element)

public int IndexOf(UIElement element)

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.

Returns int

Remove(UIElement element)

public void Remove(UIElement element)

Removes the specified element from the UIElementCollection.

ParameterTypeDescription
elementUIElementThe UIElement to remove from the UIElementCollection.

Contains(UIElement element)

public bool Contains(UIElement element)

Determines whether a element is in the UIElementCollection.

Returns bool

Clear()

public void Clear()

Removes all elements from the UIElementCollection.

Insert(int index, UIElement element)

public void Insert(int index, UIElement element)

Inserts an element into the UIElementCollection at the specified index.

ParameterTypeDescription
indexintThe zero-based index at which value should be inserted.
elementUIElementThe UIElement to insert.

RemoveAt(int index)

public void RemoveAt(int index)

Removes the UIElement at the specified index.

ParameterTypeDescription
indexintThe zero-based index of the element to remove.

RemoveRange(int index, int count)

public void RemoveRange(int index, int count)

Removes a range of UIElements from the UIElementCollection.

ParameterTypeDescription
indexintThe zero-based index of the range of elements to remove
countintThe number of elements to remove.