TextElement.FindName method

Applies to Windows and Windows Phone

Retrieves an object in the object model / runtime object graph by referencing the object's x:Name or Name attribute value.

Syntax

Public Function FindName(
  name As String 
) As Object

Parameters

name

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

The name of the object to retrieve.

Return value

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

The object that has the specified name, or null if no object is retrieved.

Remarks

FrameworkElement is the class that implements Name support for most other run-time classes, but TextElement is not a FrameworkElement derived class. TextElement supports its own Name and FindName implementations, and the underlying logic for name lookup does not differentiate between TextElement and FrameworkElement. You can use the TextElement-implemented FindName to find a named FrameworkElement, and vice versa.

Because FindName relies on all the XAML sources being parsed for the Name attributes, you should not attempt to call FindName until the XAML is loaded.

Names and FindName are influenced by the concept of a XAML namescope.

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.Documents
Windows::UI::Xaml::Documents [C++]

Metadata

Windows.winmd

See also

TextElement

 

 

Show:
© 2014 Microsoft