-api-id | -api-type |
---|---|
T:Windows.UI.Xaml.Automation.Peers.ItemAutomationPeer |
winrt class |
Exposes a data item in an Items collection to Microsoft UI Automation.
ItemAutomationPeer is generated from items control logic and ItemsControlAutomationPeer, not an associated control class.
In addition to the typical peer implementation API, ItemAutomationPeer has an ItemsControlAutomationPeer property to reference its container peer. The container peer potentially supplies the logic for AutomationPeer methods as called against the ItemAutomationPeer. There is also an Item property that is similar in purpose to the Owner property on other peers (it provides the reference to the object that this peer provides the automation exposure for). Both these values must be set in the ItemAutomationPeer constructor.
ItemAutomationPeer implements the Realize method in order to support the IVirtualizedItemProvider control pattern. Clients can call their framework's equivalent pattern access to Realize to get a non-virtualized result. This generates more information about the item in an automation tree view.
ItemAutomationPeer 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 supports PatternInterface.VirtualizedItem (IVirtualizedItemProvider). Also, there is "GetContainerPeer" logic that reports information about the item container's supported patterns.
- GetClassName uses "GetContainerPeer" logic to get class name information. If there is no container peer, calling GetClassName throws ElementNotAvailableException.
- GetName uses "GetContainerPeer" logic but if no container peer exists it will use a basic
ToString()
logic to try and generate a default automation name from the item content. - GetAutomationControlType uses "GetContainerPeer" logic to get control type information. If there is no container peer, returns AutomationControlType.ListItem.
- "GetContainerPeer" logic is used to forward most of the other AutomationPeer methods from the container peer implementations if possible. For example, IsControlElement might check the container peer first. Some of these AutomationPeer methods will throw ElementNotAvailableException if there is no container peer available. This is one of the only peer classes in the Windows Runtime support for Microsoft UI Automation that does not use FrameworkElementAutomationPeer as a base class.
ItemAutomationPeer is the parent class for SelectorItemAutomationPeer.