AutomationPeer.GetName Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the value that the automation peer reports as the UI Automation Name for the associated control.

Namespace:  System.Windows.Automation.Peers
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Function GetName As String
public string GetName()

Return Value

Type: System.String
The value to report as the UI Automation Name.

Remarks

Peers that affect the GetName value by overriding GetNameCore are generally implementing a behavior that can construct a usable UI Automation Name on basis of other property values of the associated control. For example, GetNameCore() implements a behavior that can process the button content by calling ToString on the content, and then returns the string so long as it is not empty or null. This enables a button composition such as <Button>OK</Button> to report its default UI Automation Name as "OK", without requiring any other usercode such as specifying AutomationProperties.Name.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.