-api-id | -api-type |
---|---|
T:Microsoft.UI.Xaml.Automation.Peers.ListBoxItemAutomationPeer |
winrt class |
Exposes the items in the Items collection of a ListBox to Microsoft UI Automation.
The Windows Runtime ListBoxItem class creates a new ListBoxItemAutomationPeer as its OnCreateAutomationPeer definition. Derive your automation peer from ListBoxItemAutomationPeer if you are deriving a custom class from ListBoxItem and want to add automation support for additional features that you enabled in your custom class. Then override OnCreateAutomationPeer so that it returns your custom peer.
ListBoxItemAutomationPeer 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 doesn't have any patterns. However, the content of the ListBoxItem might have a specific peer, for example if it is a TextBox. The parent ListBox has the support for any selection-related automation behavior.
- GetClassName returns "ListBoxItem".
- GetAutomationControlType returns AutomationControlType.ListItem.
- Because a ListBoxItem is a ContentControl, GetName returns a string value based on examining the current Content. This is implemented so that consumers of the control don't always need to provide an AutomationProperties.Name value in app code, and can use a generated-from-content value for the automation Name directly from the UI definition. For more info on how this works, see Basic accessibility information. 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.
FrameworkElementAutomationPeer, ListBoxItem, ListBox, Custom automation peers