UI Automation Support for the ScrollBar Control Type

System_CAPS_ICON_note.jpg Note

This documentation is intended for .NET Framework developers who want to use the managed UI Automation classes defined in the System.Windows.Automation namespace. For the latest information about UI Automation, see Windows Automation API: UI Automation.

This topic provides information about UI Automation support for the ScrollBar control type. In UI Automation, a control type is a set of conditions that a control must meet in order to use the ControlTypeProperty property. The conditions include specific guidelines for UI Automation tree structure, UI Automation property values and control patterns.

Scroll bar controls enable a user to scroll content within a window or item container. The control is made up 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 list controls, whether Windows Presentation Foundation (WPF), Win32, or Windows Forms.

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 on the UI Automation tree, see UI Automation Tree Overview.

Control ViewContent View

- Button (2 or 4)
- Thumb (0 or1)
Not applicable. The scroll bar control does not contain 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 AutomationIdProperty value to each item to make them discoverable for test automation tools.

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 PropertyValueNotes
AutomationIdPropertySee notes.The value of this property needs to be unique across all controls in an application.
BoundingRectanglePropertySee notes.The outermost rectangle that contains the whole control.
IsKeyboardFocusablePropertySee notes.If the control can receive keyboard focus, it must support this property.
NamePropertyNullThe scroll bar control does not have content elements and the NameProperty is not required to be set.
ClickablePointPropertyNot a number.The scroll bar control does not have clickable points.
LabeledByPropertyNullScroll bars do not have labels.
ControlTypePropertyScrollBarThis value is the same for all frameworks. Scroll bars that function as sliders must use the Slider control type.
LocalizedControlTypeProperty"scroll bar"Localized string that corresponds to the Button control type.
IsContentElementPropertyFalseThe scroll bar control is never a content element. If the scroll bar is a standalone control, then it must fulfill the Slider control type and return ControlType.Slider for the ControlType property.
IsControlElementPropertyTrueThe scroll bar must always be a control.
OrientationPropertyTrueThe scroll bar control must always expose its horizontal or vertical orientation.

The following table lists the UI Automation control patterns required to be supported by scroll bar controls. For more information on control patterns, see UI Automation Control Patterns Overview. Note that 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 PatternSupportNotes
IScrollProviderNeverThe Scroll control pattern is never directly supported on the scroll bar.
IRangeValueProviderDependsThis functionality is required to be supported only if the Scroll control pattern is not supported on the container that has the scroll bar.

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

UI Automation EventSupport/ValueNotes
BoundingRectangleProperty property-changed event.RequiredNone
IsOffscreenProperty property-changed event.RequiredNone
IsEnabledProperty property-changed event.RequiredNone
HorizontallyScrollableProperty property-changed event.NeverNone
HorizontalScrollPercentProperty property-changed event.NeverNone
HorizontalViewSizeProperty property-changed event.NeverNone
VerticalScrollPercentProperty property-changed event.NeverNone
VerticallyScrollableProperty property-changed event.NeverNone
VerticalViewSizeProperty property-changed event.NeverNone
ValueProperty property-changed event.DependsNone

UI Automation Control Types Overview
UI Automation Overview