-api-id | -api-type |
---|---|
M:Windows.UI.Xaml.Documents.TextElement.FindName(System.String) |
winrt method |
Retrieves an object in the object model / runtime object graph by referencing the object's x:Name or Name attribute value.
The name of the object to retrieve.
The object that has the specified name, or null if no object is retrieved.
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.