ListViewItem ListViewItem ListViewItem Class


Represents the container for an item in a ListView control.

public class ListViewItem : SelectorItem, IListViewItempublic class ListViewItem : SelectorItem, IListViewItemPublic Class ListViewItem Inherits SelectorItem Implements IListViewItem
<ListViewItem .../>
<ListViewItem ...>
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited properties

Inherited events

Inherited methods


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

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

Control style and template

You can modify the default Style and ControlTemplate to give the control a unique appearance. For information about modifying a control's style and template, see Styling controls. The default style, template, and resources that define the look of the control are included in the generic.xaml file. For design purposes, generic.xaml is available in the (Program Files)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP&lt;SDK version>\Generic folder from a Windows Software Development Kit (SDK) installation. Styles and resources from different versions of the SDK might have different values.

Starting in Windows 10, version 1607 (Windows Software Development Kit (SDK) version 10.0.14393.0), generic.xaml includes resources that you can use to modify the colors of a control in different visual states without modifying the control template. In apps that target this software development kit (SDK) or later, modifying these resources is preferred to setting properties such as Background and Foreground. For more info, see the Light-weight styling section of the Styling controls article.

This table shows the resources used by the ListViewItem control.

Resource keyDescription
ListViewItemForegroundText color at rest
ListViewItemForegroundPointerOverText color on hover
ListViewItemForegroundPressedText color when pressed
ListViewItemBackgroundBackground color at rest
ListViewItemBackgroundPointerOverBackground color on hover
ListViewItemBackgroundPressedBackground color when pressed
ListViewItemBackgroundSelectedBackground color when selected
ListViewItemBackgroundSelectedPointerOverBackground color on hover and selected
ListViewItemBackgroundSelectedPressedBackground color when pressed and selected
ListViewItemFocusVisualPrimaryBrushFocus indicator color when focused
ListViewItemFocusVisualSecondaryBrushSecondary focus indicator color when focused
ListViewItemFocusBorderBrushBorder color when focused
ListViewItemFocusSecondaryBorderBrushSecondary border color when focused
ListViewItemCheckBrushCheck mark color on selected item
ListViewItemCheckBoxBrushCheckmark box color on selected item
ListViewItemDragBackgroundItem background color when being dragged
ListViewItemDragForegroundItem foreground color when being dragged
ListViewItemPlaceholderBackgroundBackground color of item placeholder
ListViewItemSelectionCheckMarkVisualEnabledBoolean that specifies whether checkmark visual is shown
ListViewItemCheckModeSpecifies how checkmark is shown ("Overlay" or "Inline")

Windows 8.1 To assign a custom value based on the data item to the AutomationProperties.Name attached property, you must bind to the item container's Content property. For example, assume you have a Customer data item that has a Name property and you want to use the Customer.Name property as the AutomationProperties.Name value.

In Windows 8, the data item is set as the DataContext of the item container, so you can use a binding like this: AutomationProperties.Name="{Binding Name}".

In Windows 8.1, the item container's DataContext is not set. To bind the AutomationProperties.Name value to the data item's Name property, use a binding like this: AutomationProperties.Name="{Binding Path=Content.Name,RelativeSource={RelativeSource Mode=Self}}".


ListViewItem() ListViewItem() ListViewItem()

Initializes a new instance of the ListViewItem class.

public ListViewItem()public ListViewItem()Public Sub New()


TemplateSettings TemplateSettings TemplateSettings

Gets an object that provides calculated values that can be referenced as TemplateBinding sources when you're defining templates for a ListViewItem class.

public ListViewItemTemplateSettings TemplateSettings { get; }public ListViewItemTemplateSettings TemplateSettings { get; }Public ReadOnly Property TemplateSettings As ListViewItemTemplateSettings
ListViewItemTemplateSettings ListViewItemTemplateSettings ListViewItemTemplateSettings

An object that provides calculated values for templates.


See Also