Skip to main content

ListBoxItemCollection Class

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

The collection of items belonging to a ListBox.

public class ListBoxItemCollection : ICollection

Constructors

ListBoxItemCollection(ListBox listBox, UIElementCollection items)

public ListBoxItemCollection(ListBox listBox, UIElementCollection items)

Creates a collection backed by the given list box and element collection.

Properties

index]

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

Gets or sets the item at the given index.

Count

public int Count { get; }

Number of items in the collection.

IsSynchronized

public bool IsSynchronized { get; }

Whether access to the collection is synchronized.

SyncRoot

public object SyncRoot { get; }

Object used to synchronize access to the collection.

Methods

Add(ListBoxItem item)

public int Add(ListBoxItem item)

Adds an item to the list and returns its index.

Returns int

Add(UIElement element)

public int Add(UIElement element)

Wraps an element in a new ListBoxItem, adds it, and returns its index.

Returns int

Clear()

public void Clear()

Removes all items from the list.

Contains(ListBoxItem item)

public bool Contains(ListBoxItem item)

Returns true if the list contains the given item.

Returns bool

IndexOf(ListBoxItem item)

public int IndexOf(ListBoxItem item)

Returns the index of the given item, or -1 if not found.

Returns int

Insert(int index, ListBoxItem item)

public void Insert(int index, ListBoxItem item)

Inserts an item at the given index.

Remove(ListBoxItem item)

public void Remove(ListBoxItem item)

Removes the given item from the list.

RemoveAt(int index)

public void RemoveAt(int index)

Removes the item at the given index.