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 where the UI framework/platform integrates UI Automation support for control types and control patterns.

This topic contains the following sections.

Typical Tree Structure

The following table depicts a typical control and 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 (0, 2, or 4)
    • Thumb (0 or 1)
Not applicable. (The scroll bar control has no content.)

 

The scroll bar control can have zero to five children. Because the subtree has more than one button control, the element must set a specific UIA_AutomationIdPropertyId value to each item to make them discoverable for automated testing tools.

Relevant 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 Retrieving Properties from UI Automation Elements.

UI Automation Property Value Notes
UIA_AutomationIdPropertyId See notes. The value of this property must be unique among all peer elements in the raw view of the UI Automation tree.
UIA_BoundingRectanglePropertyId See notes. The outermost rectangle that contains the whole control.
UIA_ClickablePointPropertyId NaN 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 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 scroll bar 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 See notes. The scroll bar control must always expose its horizontal or vertical orientation.

 

Required 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 Support Notes
IRangeValueProvider Depends The RangeValue control pattern 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 Events

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

UI Automation Event Notes
UIA_AutomationFocusChangedEventId
UIA_BoundingRectanglePropertyId property-changed event.
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
UIA_RangeValueValuePropertyId property-changed event. If the control supports the RangeValue control pattern, it must support this event.

 

Conceptual

UI Automation Control Types Overview

UI Automation Overview