Microsoft Silverlight will reach end of support after October 2021. Learn more.
Gets an object in the Silverlight object model by referencing the object's x:Name or Name attribute value.
Assembly: System.Windows (in System.Windows.dll)
'Declaration Public Function FindName ( _ name As String _ ) As Object
public Object FindName( string name )
The name of the object to retrieve.
The object that has the specified name, or nulla null reference (Nothing in Visual Basic) if no object is retrieved.
FrameworkElement is the class that implements Name support for most other Silverlight objects, such as Canvas, but TextElement is not a FrameworkElement. Therefore TextElement supports its own Name and FindName implementations so that you can still retrieve XAML-instantiated instances of TextElement classes such as Run at run time, and you can arbitrarily call FindName again on any Silverlight object you retrieved from calling FindName previously. You can use the TextElement-defined FindName to find a named element specified as a FrameworkElement Name,and vice versa. Because FindName relies on all XAML being parsed for the Name attributes, you should not attempt to call FindName until the XAML is loaded. There are limitations across XAML namescopes. For details, see XAML Namescopes.
Supported in: 5, 4
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.