-api-id | -api-type |
---|---|
T:Windows.UI.Xaml.Automation.Peers.ToggleSwitchAutomationPeer |
winrt class |
Exposes ToggleSwitch types to Microsoft UI Automation.
The Windows Runtime ToggleSwitch class creates a new ToggleSwitchAutomationPeer as its OnCreateAutomationPeer definition. ToggleSwitch is sealed, so the normal scenario of deriving from the ToggleSwitch class and its existing peer isn't applicable to ToggleSwitchAutomationPeer.
ToggleSwitchAutomationPeer has overrides of Core methods such that the associated AutomationPeer methods provide peer-specific information to a Microsoft UI Automation client.
- GetPattern reports that the peer provides pattern support for PatternInterface.Toggle (IToggleProvider).
- GetClassName returns "ToggleSwitch".
- GetAutomationControlType returns AutomationControlType.Button.
- GetLocalizedControlType returns a localized resource string. This is usually handled in FrameworkElementAutomationPeer but ToggleSwitchAutomationPeer has its own implementation. This peer raises toggle-related automation events on behalf of its owner class.
Although a ToggleSwitch can have text content, there is no GetName implementation that can use a string representation. You should set a value for automation Name using the AutomationProperties attached properties.
The peer also has other behaviors that are provided by the base FrameworkElementAutomationPeer class. For more info, see "Base implementation in FrameworkElementAutomationPeer" section of Custom automation peers.
ToggleSwitch, FrameworkElementAutomationPeer, IToggleProvider, Custom automation peers