ComboBoxItem ComboBoxItem ComboBoxItem Class

Represents the container for an item in a ComboBox control.

Syntax

Declaration

public class ComboBoxItempublic class ComboBoxItemPublic Class ComboBoxItem
<ComboBoxItem .../>
-or-
<ComboBoxItem ...>
  content
</ComboBoxItem>

Inheritance Hierarchy

Inherited Members

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Tag
Tag
Tag
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

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&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 ComboBoxItem control.

Resource keyDescription
ComboBoxItemForegroundText color at rest
ComboBoxItemForegroundPointerOverText color on hover
ComboBoxItemForegroundPressedText color when pressed
ComboBoxItemForegroundDisabledText color when disabled
ComboBoxItemForegroundSelectedText color when selected
ComboBoxItemForegroundSelectedUnfocusedText color when unfocused and selected
ComboBoxItemForegroundSelectedPointerOverText color on hover and selected
ComboBoxItemForegroundSelectedPressedText color when pressed and selected
ComboBoxItemForegroundSelectedDisabledText color when disabled and selected
ComboBoxItemBackgroundBackground color at rest
ComboBoxItemBackgroundPointerOverBackground color on hover
ComboBoxItemBackgroundPressedBackground color when pressed
ComboBoxItemBackgroundDisabledBackground color when disabled
ComboBoxItemBackgroundSelectedBackground color when selected
ComboBoxItemBackgroundSelectedUnfocusedBackground color when unfocused and selected
ComboBoxItemBackgroundSelectedPointerOverBackground color on hover and selected
ComboBoxItemBackgroundSelectedPressedBackground color when pressed and selected
ComboBoxItemBackgroundSelectedDisabledBackground color when disabled and selected
ComboBoxItemBorderBrushBorder color at rest
ComboBoxItemBorderBrushPointerOverBorder color on hover
ComboBoxItemBorderBrushPressedBorder color when pressed
ComboBoxItemBorderBrushDisabledBorder color when disabled
ComboBoxItemBorderBrushSelectedBorder color when selected
ComboBoxItemBorderBrushSelectedUnfocusedBorder color when unfocused and selected
ComboBoxItemBorderBrushSelectedPointerOverBorder color on hover and selected
ComboBoxItemBorderBrushSelectedPressedBorder color when pressed and selected
ComboBoxItemBorderBrushSelectedDisabledBorder color when disabled and selected

Constructors summary

Initializes a new instance of the ComboBoxItem class.

Constructors

  • ComboBoxItem()
    ComboBoxItem()
    ComboBoxItem()
    ComboBoxItem()

    Initializes a new instance of the ComboBoxItem class.

    public ComboBoxItem()public ComboBoxItem()Public Function ComboBoxItem() As

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute
Windows.Foundation.Metadata.ComposableAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.ContractVersionAttribute

Details

Assembly

Windows.UI.Xaml.Controls.dll