Share via


UI Automation Support for the ScrollBar Control Type

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

Scroll bar controls enable a user to scroll content within a window or item container. The control consists of a set of buttons and a thumb control.

The following sections define the required UI Automation tree structure, properties, control patterns, and events for the ScrollBar control type. The UI Automation requirements apply to all scroll bar 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 scroll bar 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
  • ScrollBar
    • Button (2 or 4)
    • Thumb (0 or 1)
Not applicable. (The scroll bar control has no content.)

The scroll bar control always has three to five children. Because the subtree has more than one button control, you must set a specific UIA_AutomationIdPropertyId value to each item to make them discoverable for test automation tools.

Required UI Automation Properties

The following table lists the UI Automation properties whose value or definition is especially relevant to scroll bar controls. Note that a scroll bar control never has content; its functionality is exposed through the Scroll control pattern, which is supported on the container being scrolled.

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 Not a number. The scroll bar control does not have clickable points.
UIA_ControlTypePropertyId ScrollBar This value is the same for all frameworks. Scroll bars that function as sliders must use the Slider control type.
UIA_IsContentElementPropertyId FALSE The scroll bar control is never a content element. If the scroll bar is a standalone control, it must fulfill the Slider control type and return UIA_SliderControlTypeId for the IUIAutomationElement::CurrentControlType (or IUIAutomationElement::CachedControlType) property.
UIA_IsControlElementPropertyId TRUE The scroll bar control is always included in the control view of the UI Automation tree.
UIA_IsKeyboardFocusablePropertyId See notes. If the control can receive keyboard focus, it must support this property. A scroll bar control rarely takes the focus, but when it does, the focus should remain on the scrollbar control itself, not on the child buttons or the thumb. The user should be able to perform all scrolling actions by using the UP ARROW and DOWN ARROW (or RIGHT ARROW and LEFT ARROW) keys, or the PAGE UP and PAGE DOWN keys.
UIA_LabeledByPropertyId NULL Scroll bars do not have labels.
UIA_LocalizedControlTypePropertyId See notes. Localized string corresponding to the ScrollBar control type. The default value is "scroll bar" for en-US or English (United States).
UIA_NamePropertyId NULL The scroll bar control does not have content elements and the UIA_NamePropertyId property is not required to be set.
UIA_OrientationPropertyId TRUE The scroll bar control must always expose its horizontal or vertical orientation.

Required UI Automation Control Patterns

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

Note  When a scroll bar is used as a control for mouse manipulation only, it does not support control patterns. If it is used as a slider control within an application, it must be given the Slider control type.

Control Pattern/Pattern Property Support/Value Notes
IRangeValueProvider Depends This functionality is required to be supported only if the Scroll control pattern is not supported on the container that has the scroll bar.
IScrollProvider Never The Scroll control pattern is never directly supported on the scroll bar.

Required UI Automation Events

The following table lists the UI Automation events that scroll bar contols 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_ValueValuePropertyId property-changed event. If the control supports the Value control pattern, it must support this event.