ListBoxItem
Last updated
Last updated
The ListBoxItem class is used by the ListBox control for each instance added to the ListBox.Items property.
Gum Forms includes a default ListBoxItem implementation which includes a single label.
ListBoxItems can be implicitly instantiated by adding any type of object to a ListBox. The following code creates 20 ListBoxItems, each displaying an integer.
By default each item in a ListBox creates a new ListBoxItem. The ListBoxItem calls ToString on the item. Some types, such as int
have ToString methods which display expressive values.
Other types simply display their type when added. For example, the following code adds ListBoxItems which displays the type:
This also includes adding Gum objects (such as Sprite). If a Sprite is added, the Sprite is not displayed, but rather the type of the Sprite is displayed, as shown in the following code: