Share via


UI Automation Support for the ComboBox Control Type

This topic provides information about Microsoft UI Automation support for the ComboBox control type.

A combo box is a list box combined with a static control or an edit control that displays the currently selected item in the list box portion of the combo box. The list box portion of the control is displayed at all times or only appears when the user selects the drop-down arrow (which is a push button) next to the control. If the selection field is an edit control, the user can enter information that is not in the list; otherwise, the user can only select items in the list.

The following sections define the required UI Automation tree structure, properties, control patterns, and events for the ComboBox control type. The UI Automation requirements apply to all combo box controls, whether Microsoft Windows Presentation Foundation (WPF), Microsoft Win32, or Windows Forms.

This topic contains the following sections.

  • Required UI Automation Tree Structure
  • Required UI Automation Properties
  • Required UI Automation Control Patterns
  • Required UI Automation Events
  • Related Topics

Required UI Automation Tree Structure

The following table depicts the control view and the content view of the UI Automation tree that pertains to combo box controls and describes what can be contained in each view. For more information about the UI Automation tree, see UI Automation Tree Overview.

Control View Content View
  • ComboBox
    • Edit (0 or 1)
    • List (1)
    • List Item (child of List; 0 to many)
    • Button (1)
  • ComboBox
    • List Item (0 to many)

The edit control in the control view of the combo box is necessary only if the combo box can be edited to take any input, as is the case of the combo box in the Run dialog box.

Required UI Automation Properties

The following table lists the UI Automation properties whose value or definition is especially relevant to the ComboBox control type. For more information about UI Automation properties, see UI Automation Properties for Clients.

UI Automation Property Value Notes
UIA_AutomationIdPropertyId See notes. The value of this property needs to be unique across all controls in an application.
UIA_BoundingRectanglePropertyId See notes. The outermost rectangle that contains the whole control.
UIA_ClickablePointPropertyId See notes. Supported if there is a bounding rectangle. If not every point within the bounding rectangle is clickable, and you perform specialized hit testing, override and provide a clickable point.
UIA_ControlTypePropertyId ComboBox This value is the same for all UI frameworks.
UIA_HelpTextPropertyId See notes. The help text for combo box controls should explain why the user is being asked choose an option from the combo box. The text is similar to information presented through a tooltip. For example, "Select an item to set the display resolution of your monitor."
UIA_IsContentElementPropertyId TRUE Combo box controls are always included in the content view of the UI Automation tree.
UIA_IsControlElementPropertyId TRUE Combo box controls are always included in the control view of the UI Automation tree.
UIA_IsKeyboardFocusablePropertyId TRUE Combo box controls can receive keyboard focus; however, when a UI Automation client sets focus to a combo box, any item in the combo box subtree can receive the focus.
UIA_LabeledByPropertyId See notes. Combo box controls typically have a static text label that this property references.
UIA_LocalizedControlTypePropertyId See notes. Localized string corresponding to the ComboBox control type. The default value is "combo box" for en-US or English (United States).
UIA_NamePropertyId See notes. The combo box control typically gets its name from a static text control.

Required UI Automation Control Patterns

The following table lists the UI Automation control patterns required to be supported by all combo box controls. For more information on control patterns, see UI Automation Control Patterns Overview.

Control Pattern/Pattern Property Support/Value Notes
IExpandCollapseProvider Yes A combo box control must always contain a drop-down button.
ISelectionProvider Yes Displays the current selection in the combo box. This support is delegated to the list box beneath the combo box.
IValueProvider Depends If the combo box can take arbitrary text values, the Value control pattern must be supported. This pattern enables the string contents of the combo box to be set programmatically. If the Value control pattern is not supported, the user must select from the list items within the subtree of the combo box.
IScrollProvider Never The Scroll control pattern is never supported directly on a combo box. It is supported if a list box contained within a combo box can scroll, and only when the list box is visible on the screen.

Required UI Automation Events

The following table lists the UI Automation events that combo box controls are required to support. For more information on events, see UI Automation Events Overview.

UI Automation Event Notes
UIA_AutomationFocusChangedEventId None
UIA_BoundingRectanglePropertyId property-changed event. None
UIA_IsEnabledPropertyId property-changed event. If the control supports the IsEnabled property, it must support this event.
UIA_IsOffscreenPropertyId property-changed event. If the control supports the IsOffscreen property, it must support this event.
UIA_StructureChangedEventId None
UIA_ExpandCollapseExpandCollapseStatePropertyId property-changed event. None
UIA_ValueValuePropertyId property-changed event. If the control supports the Value control pattern, it must support this event.