Implementing the UI Automation Toggle Control Pattern

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

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.

The following properties and methods are required for implementing IToggleProvider.

Required memberMember typeNotes
ToggleMethodNone
ToggleStatePropertyPropertyNone

This control pattern has no associated events.

This control pattern has no associated exceptions.

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

Show: