title | description | ms.date | dev_langs | helpviewer_keywords | ms.topic | |||||
---|---|---|---|---|---|---|---|---|---|---|
Get the Toggle State of a Check Box Using UI Automation |
See a code example that shows how to get the toggle state of a control (such as a check box) using Microsoft UI Automation. |
03/30/2017 |
|
|
how-to |
Note
This documentation is intended for .NET Framework developers who want to use the managed UI Automation classes defined in the xref:System.Windows.Automation namespace. For the latest information about UI Automation, see Windows Automation API: UI Automation.
This topic shows how to use Microsoft UI Automation to get the toggle state of a control.
This example uses the xref:System.Windows.Automation.AutomationElement.GetCurrentPattern%2A method of the xref:System.Windows.Automation.AutomationElement class to obtain a xref:System.Windows.Automation.TogglePattern object from a control and return its xref:System.Windows.Automation.ToggleState property.
[!code-csharpNavigatingWithTreeWalker#1200] [!code-vbNavigatingWithTreeWalker#1200]