Freigeben über


Implementing the UI Automation Toggle Control Pattern

This topic introduces guidelines and conventions for implementing IToggleProvider, including information about methods and properties. Links to additional references are listed at the end of the topic.

The TogglePattern control pattern is used to support controls that can cycle through a set of states and maintain a state once set. For examples of controls that implement this control pattern, see Control Pattern Mapping for UI Automation Clients.

This topic contains the following sections.

  • Implementation Guidelines and Conventions
  • Required Members for IToggleProvider
  • Exceptions
  • Related Topics

Implementation Guidelines and Conventions

When implementing the Toggle control pattern, note the following guidelines and conventions:

  • Controls that do not maintain state when activated, such as buttons, toolbar buttons, and hyperlinks, must implement IInvokeProvider instead.

  • A control must cycle through its ToggleState in the following order: On, Off and, if supported, Indeterminate.

  • TogglePattern does not provide a SetState(newState) method due to issues surrounding the direct setting of a tri-state CheckBox without cycling through its appropriate ToggleState sequence.

  • The RadioButton control does not implement IToggleProvider, as it is not capable of cycling through its valid states.

Required Members for IToggleProvider

The following properties and methods are required for implementing IToggleProvider.

Required member Member type Notes

Toggle

Method

None

ToggleStateProperty

Property

None

This control pattern has no associated events.

Exceptions

This control pattern has no associated exceptions.

See Also

Tasks

Support Control Patterns in a UI Automation Provider
Get the Toggle State of a Check Box Using UI Automation
Use Caching in UI Automation

Concepts

UI Automation Control Patterns Overview
UI Automation Control Patterns for Clients
UI Automation Tree Overview