Jaa


AutomationPeer.GetNameCore Method

Definition

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

protected:
 virtual Platform::String ^ GetNameCore() = GetNameCore;
winrt::hstring GetNameCore();
protected virtual string GetNameCore();
function getNameCore()
Protected Overridable Function GetNameCore () As String

Returns

String

Platform::String

winrt::hstring

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

Remarks

FrameworkElementAutomationPeer introduces behavior to GetName by providing an intermediate GetNameCore implementation. If an element has a value for the LabeledByMicrosoft UI 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.

Applies to

See also