GridViewItem
GridViewItem
GridViewItem
GridViewItem
Class
Definition
public : class GridViewItem : SelectorItem, IGridViewItempublic class GridViewItem : SelectorItem, IGridViewItemPublic Class GridViewItem Inherits SelectorItem Implements IGridViewItem// This API is not available in Javascript.
<GridViewItem .../>
-or-
<GridViewItem ...>
content
</GridViewItem>
- Inheritance
-
GridViewItemGridViewItemGridViewItemGridViewItem
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Inherited Members
Inherited properties
Inherited events
Inherited methods
Remarks
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<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 key | Description |
|---|---|
| GridViewItemForeground | Text color at rest |
| GridViewItemForegroundPointerOver | Text color on hover |
| GridViewItemForegroundPressed | Text color when pressed |
| GridViewItemBackground | Background color at rest |
| GridViewItemBackgroundPointerOver | Background color on hover |
| GridViewItemBackgroundPressed | Background color when pressed |
| GridViewItemBackgroundSelected | Background color when selected |
| GridViewItemBackgroundSelectedPointerOver | Background color on hover and selected |
| GridViewItemBackgroundSelectedPressed | Background color when pressed and selected |
| GridViewItemFocusVisualPrimaryBrush | Focus indicator color when focused |
| GridViewItemFocusVisualSecondaryBrush | Secondary focus indicator color when focused |
| GridViewItemFocusBorderBrush | Border color when focused |
| GridViewItemFocusSecondaryBorderBrush | Secondary border color when focused |
| GridViewItemCheckBrush | Check mark color on selected item |
| GridViewItemCheckBoxBrush | Checkmark box color on selected item |
| GridViewItemDragBackground | Item background color when being dragged |
| GridViewItemDragForeground | Item foreground color when being dragged |
| GridViewItemPlaceholderBackground | Background color of item placeholder |
| GridViewItemSelectionCheckMarkVisualEnabled | Boolean that specifies whether checkmark visual is shown |
| GridViewItemCheckMode | Specifies 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
Customerdata item that has aNameproperty and you want to use theCustomer.Nameproperty 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}}".
Constructors
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.
Properties
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.
- Value
- GridViewItemTemplateSettings GridViewItemTemplateSettings GridViewItemTemplateSettings GridViewItemTemplateSettings
An object that provides calculated values for templates.