UIElementAutomationPeer.CreatePeerForElement(UIElement) Method

Definition

Creates a UIElementAutomationPeer for the specified UIElement.

public:
 static System::Windows::Automation::Peers::AutomationPeer ^ CreatePeerForElement(System::Windows::UIElement ^ element);
public static System.Windows.Automation.Peers.AutomationPeer CreatePeerForElement (System.Windows.UIElement element);
static member CreatePeerForElement : System.Windows.UIElement -> System.Windows.Automation.Peers.AutomationPeer
Public Shared Function CreatePeerForElement (element As UIElement) As AutomationPeer

Parameters

element
UIElement

The UIElement that is associated with this UIElementAutomationPeer.

Returns

The created UIElementAutomationPeer for the specified UIElement.

Remarks

This UIElementAutomationPeer remains in memory until the associated UIElement is destroyed.

The same instance of the UIElementAutomationPeer is returned from subsequent calls to this method and calls to FromElement. The type of the peer is determined by the OnCreateAutomationPeer virtual callback. If UIElement does not implement the callback, no UIElementAutomationPeer is created, and this method returns null.

Applies to