Windows.UI.Xaml.Controls.ListBoxItem

July 18, 2022 · View on GitHub

-description

Represents the container for an item in a ListBox control.

-xaml-syntax

<ListBoxItem .../>
-or-
<ListBoxItem ...>
  content
</ListBoxItem>

-remarks

The ListBoxItem class provides the container for items displayed in a ListBox control. You populate the ListBox by adding ListBoxItems directly to its Items collection or by binding its ItemsSource property to a data source. When items are added to the ListBox, a ListBoxItem container is created automatically for each item in the collection.

You can specify the look of the ListBoxItem by setting the ListBox's ItemContainerStyle property to a Style with a TargetType of ListBoxItem.

-examples

Tip

For more info, design guidance, and code examples, see List boxes.

If you have the WinUI 2 Gallery app installed, click here to open the app and see the ListBox in action.

-see-also

SelectorItem, ListBox, ItemContainerStyle