Share via


UI Automation Support for the ScrollBar Control Type

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.

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

Control View

Content View

ScrollBar

  • 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.

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

AutomationIdProperty

See notes.

The value of this property needs to be unique across all controls in an application.

BoundingRectangleProperty

See notes.

The outermost rectangle that contains the whole control.

IsKeyboardFocusableProperty

See notes.

If the control can receive keyboard focus, it must support this property.

NameProperty

Null

The scroll bar control does not have content elements and the NameProperty is not required to be set.

ClickablePointProperty

Not a number.

The scroll bar control does not have clickable points.

LabeledByProperty

Null

Scroll bars do not have labels.

ControlTypeProperty

ScrollBar

This 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.

IsContentElementProperty

False

The 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.

IsControlElementProperty

True

The scroll bar must always be a control.

OrientationProperty

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 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 Pattern

Support

Notes

IScrollProvider

Never

The Scroll control pattern is never directly supported on the scroll bar.

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.

Required UI Automation Events

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 Event

Support/Value

Notes

BoundingRectangleProperty property-changed event.

Required

None

IsOffscreenProperty property-changed event.

Required

None

IsEnabledProperty property-changed event.

Required

None

HorizontallyScrollableProperty property-changed event.

Never

None

HorizontalScrollPercentProperty property-changed event.

Never

None

HorizontalViewSizeProperty property-changed event.

Never

None

VerticalScrollPercentProperty property-changed event.

Never

None

VerticallyScrollableProperty property-changed event.

Never

None

VerticalViewSizeProperty property-changed event.

Never

None

ValueProperty property-changed event.

Depends

None

AutomationFocusChangedEvent

Required

None

StructureChangedEvent

Required

None

See Also

Reference

ScrollBar

Concepts

UI Automation Control Types Overview

UI Automation Overview