Share via


UI Automation Support for the Spinner Control Type

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

Spinner controls are used to select from a domain of items or a range of numbers.

The following sections define the required UI Automation tree structure, properties, control patterns, and events for the Spinner control type. The UI Automation requirements apply to all spinner 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 pertain to spinner controls when they support the RangeValue and Selection control patterns and describes what can be contained in each view. For more information about the UI Automation tree, see UI Automation Tree Overview.

RangeValue control pattern

Control View Content View
  • Spinner
    • Edit (0 or 1)
    • Button (2)
  • Spinner

Selection control pattern

Control View Content View
  • Spinner
    • Edit (0 or 1)
    • Button (2)
    • List Item (0 or more)
  • Spinner
    • ListItem (0 or more)

To ensure that the two buttons in the control view subtree can be distinguished by automated test tools, assign the SmallIncrement or ScrollAmount_SmallDecrement AutomationId as appropriate.

Required UI Automation Properties

The following table lists the UI Automation properties whose value or definition is especially relevant to spinner controls. 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. The spinner control's clickable point gives focus to the edit portion of the control.
UIA_ControlTypePropertyId spinner This value is the same for all frameworks.
UIA_IsContentElementPropertyId TRUE The spinner control must always be content.
UIA_IsControlElementPropertyId TRUE The spinner control must always be a control.
UIA_IsKeyboardFocusablePropertyId See notes. If the control can receive keyboard focus, it must support this property. A spinner control rarely takes the focus, but when it does, the focus should remain on the spinner control itself, not on the child buttons. The user should be able to perform all scrolling actions by using the UP ARROW and DOWN ARROW keys.
UIA_LabeledByPropertyId See notes. Spinner controls have a static text label.
UIA_LocalizedControlTypePropertyId See notes. Localized string corresponding to the Spinner control type. The default value is "spinner" for en-US or English (United States).
UIA_NamePropertyId See notes. The spinner control typically gets its name from a static text label.

Required UI Automation Control Patterns

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

Control Pattern/Pattern Property Support/Value Notes
IRangeValueProvider Depends Spinner controls that span a numeric range can support this pattern.
ISelectionProvider Depends Spinner controls that have a list of items to be selected must support this pattern.
ISelectionProvider::CanSelectMultiple FALSE Spinner controls are always single selection containers.
IValueProvider Depends Spinner controls that span a descrete set of options or numbers can support this pattern.

Required UI Automation Events

The following table lists the UI Automation events that spinner 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_RangeValueValuePropertyId property-changed event. If the control supports the RangeValue control pattern, it must support this event.
UIA_Selection_InvalidatedEventId property-changed event. If the control supports the Selection control pattern, it must support this event.
UIA_StructureChangedEventId None
UIA_ValueValuePropertyId property-changed event. If the control supports the Value control pattern, it must support this event.