Expand Minimize

AutomationPeer.GetNameCore method

Applies to Windows and Windows Phone

Provides the peer's behavior when a Microsoft UI Automation client calls GetName or an equivalent UI Automation client API.

Syntax


protected virtual string GetNameCore()

Parameters

This method has no parameters.

Return value

Type: System.String [.NET] | Platform::String [C++]

The name as used by assistive technologies and other UI Automation clients.

Remarks

The "Core" methods are the standard implementations that perform the default action of an associated UI Automation client-callable method. You can override any of the "Core" methods to return alternative values in a custom automation peer. In this case, GetNameCore is invoked any time that GetName is called.

FrameworkElementAutomationPeer introduces behavior to GetName by providing an intermediate GetNameCore implementation. If an element has a value for the LabeledByUI Automation property, the labeling element's Name value is used as the Name.

FrameworkElementAutomationPeer also introduces behavior through an internal GetPlainText method that other default peer classes may override in order to access the content model of that control and return a useful default for Name. For example, any ContentControl derived class will use a string representation of its Content value as the default Name. This is enabled because internally ContentControl implements GetPlainText and imparts that behavior to all ContentControl derived classes. This is how you get a useful Name default from the string value of a Button, for example.

Other specific peers also may have an intermediate GetNameCore implementation that provides a useful way for that particular Windows Runtime control to provide built-in values for Name. The source of these values comes from other UI properties that are typically set in XAML or as app user code. For example, TextBoxAutomationPeer implements behavior that uses the value of the Text property from the owner TextBox as the default Name. From the user code perspective, the default behavior can be overridden by applying a different AutomationProperties.Name value. From the peer implementer / provider perspective, the default behavior of the peer can be changed by deriving a new peer class from the existing peer, overriding GetNameCore, and giving it a new implementation that wouldn't call the base implementation in at least some cases.

To learn more about the possible default behavior of specific peer classes for default Windows Runtime controls, see the reference topic for that particular peer class and look for implementation notes in the Remarks section.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Automation.Peers
Windows::UI::Xaml::Automation::Peers [C++]

Metadata

Windows.winmd

See also

AutomationPeer
GetName
Custom automation peers

 

 

Show:
© 2014 Microsoft