ComboBoxItem
ComboBoxItem
ComboBoxItem
ComboBoxItem
Class
Definition
public : class ComboBoxItem : SelectorItem, IComboBoxItempublic class ComboBoxItem : SelectorItem, IComboBoxItemPublic Class ComboBoxItem Inherits SelectorItem Implements IComboBoxItem// This API is not available in Javascript.
<ComboBoxItem .../>
-or-
<ComboBoxItem ...>
content
</ComboBoxItem>
- Inheritance
-
ComboBoxItemComboBoxItemComboBoxItemComboBoxItem
- 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 ComboBoxItem class provides the container for items displayed in a ComboBox control. You populate the ComboBox by adding objects directly to its Items collection or by binding its ItemsSource property to a data source. When items are added to the ComboBox, a ComboBoxItem container is created automatically for each item in the collection.
You can specify the look of the ComboBoxItem by setting the ComboBox 's ItemContainerStyle property to a Style with a TargetType of ComboBoxItem.
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 ComboBoxItem control.
| Resource key | Description |
|---|---|
| ComboBoxItemForeground | Text color at rest |
| ComboBoxItemForegroundPointerOver | Text color on hover |
| ComboBoxItemForegroundPressed | Text color when pressed |
| ComboBoxItemForegroundDisabled | Text color when disabled |
| ComboBoxItemForegroundSelected | Text color when selected |
| ComboBoxItemForegroundSelectedUnfocused | Text color when unfocused and selected |
| ComboBoxItemForegroundSelectedPointerOver | Text color on hover and selected |
| ComboBoxItemForegroundSelectedPressed | Text color when pressed and selected |
| ComboBoxItemForegroundSelectedDisabled | Text color when disabled and selected |
| ComboBoxItemBackground | Background color at rest |
| ComboBoxItemBackgroundPointerOver | Background color on hover |
| ComboBoxItemBackgroundPressed | Background color when pressed |
| ComboBoxItemBackgroundDisabled | Background color when disabled |
| ComboBoxItemBackgroundSelected | Background color when selected |
| ComboBoxItemBackgroundSelectedUnfocused | Background color when unfocused and selected |
| ComboBoxItemBackgroundSelectedPointerOver | Background color on hover and selected |
| ComboBoxItemBackgroundSelectedPressed | Background color when pressed and selected |
| ComboBoxItemBackgroundSelectedDisabled | Background color when disabled and selected |
| ComboBoxItemBorderBrush | Border color at rest |
| ComboBoxItemBorderBrushPointerOver | Border color on hover |
| ComboBoxItemBorderBrushPressed | Border color when pressed |
| ComboBoxItemBorderBrushDisabled | Border color when disabled |
| ComboBoxItemBorderBrushSelected | Border color when selected |
| ComboBoxItemBorderBrushSelectedUnfocused | Border color when unfocused and selected |
| ComboBoxItemBorderBrushSelectedPointerOver | Border color on hover and selected |
| ComboBoxItemBorderBrushSelectedPressed | Border color when pressed and selected |
| ComboBoxItemBorderBrushSelectedDisabled | Border color when disabled and selected |
Constructors
ComboBoxItem() ComboBoxItem() ComboBoxItem() ComboBoxItem()
Initializes a new instance of the ComboBoxItem class.
public : ComboBoxItem()public ComboBoxItem()Public Sub New()// This API is not available in Javascript.