-api-id | -api-type |
---|---|
T:Windows.UI.Xaml.Controls.ListBoxItem |
winrt class |
Represents the container for an item in a ListBox control.
<ListBoxItem .../>
-or-
<ListBoxItem ...>
content
</ListBoxItem>
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.
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.