GridViewItem GridViewItem GridViewItem GridViewItem Class


Represents the container for an item in a GridView control.

public : class GridViewItem : SelectorItem, IGridViewItempublic class GridViewItem : SelectorItem, IGridViewItemPublic Class GridViewItem Inherits SelectorItem Implements IGridViewItem// This API is not available in Javascript.
<GridViewItem .../>
<GridViewItem ...>
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 GridViewItem class provides the container for items displayed in a GridView control. You populate the GridView by adding objects directly to its Items collection or by binding its ItemsSource property to a data source. When items are added to the GridView, a GridViewItem container is created automatically for each item in the collection.

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

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 GridViewItem control.

Resource keyDescription
GridViewItemForegroundText color at rest
GridViewItemForegroundPointerOverText color on hover
GridViewItemForegroundPressedText color when pressed
GridViewItemBackgroundBackground color at rest
GridViewItemBackgroundPointerOverBackground color on hover
GridViewItemBackgroundPressedBackground color when pressed
GridViewItemBackgroundSelectedBackground color when selected
GridViewItemBackgroundSelectedPointerOverBackground color on hover and selected
GridViewItemBackgroundSelectedPressedBackground color when pressed and selected
GridViewItemFocusVisualPrimaryBrushFocus indicator color when focused
GridViewItemFocusVisualSecondaryBrushSecondary focus indicator color when focused
GridViewItemFocusBorderBrushBorder color when focused
GridViewItemFocusSecondaryBorderBrushSecondary border color when focused
GridViewItemCheckBrushCheck mark color on selected item
GridViewItemCheckBoxBrushCheckmark box color on selected item
GridViewItemDragBackgroundItem background color when being dragged
GridViewItemDragForegroundItem foreground color when being dragged
GridViewItemPlaceholderBackgroundBackground color of item placeholder
GridViewItemSelectionCheckMarkVisualEnabledBoolean that specifies whether checkmark visual is shown
GridViewItemCheckModeSpecifies 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}}".


GridViewItem() GridViewItem() GridViewItem() GridViewItem()

Initializes a new instance of the GridViewItem class.

public : GridViewItem()public GridViewItem()Public Sub New()// This API is not available in Javascript.


TemplateSettings TemplateSettings TemplateSettings TemplateSettings

Gets an object that provides calculated values that can be referenced as TemplateBinding sources when defining templates for a GridViewItem.

public : GridViewItemTemplateSettings TemplateSettings { get; }public GridViewItemTemplateSettings TemplateSettings { get; }Public ReadOnly Property TemplateSettings As GridViewItemTemplateSettings// This API is not available in Javascript.

See Also