Rediger

Del via


Implementing the UI Automation Toggle Control Pattern

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

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