TextElement.FindName(String) TextElement.FindName(String) TextElement.FindName(String) TextElement.FindName(String) Method

Definition

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

public : Platform::Object FindName(Platform::String name)
winrt::Windows::Foundation::IInspectable FindName(winrt::hstring name) const;
public object FindName(String name)
Public Function FindName(name As String) As object

Parameters

name
String String

The name of the object to retrieve.

Returns

object object

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.