Element. Find Name(String) Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Retrieves an object in the object model / runtime object graph by referencing the object's x:Name or Name attribute value.
public: virtual Platform::Object ^ FindName(Platform::String ^ name) = FindName;
IInspectable FindName(winrt::hstring const& name);
public object FindName(string name);
Public Function FindName (name As String) As Object
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.
Submit and view feedback for