Attempts to find and return an object that has the specified name. The search starts from the specified object and continues into subnodes of the logical tree.
Assembly: PresentationFramework (in PresentationFramework.dll)
public static DependencyObject FindLogicalNode( DependencyObject logicalTreeNode, string elementName )
- Type: System.Windows.DependencyObject
- Type: System.String
The name of the object to find.
Return ValueType: System.Windows.DependencyObject
The object with the matching name, if one is found; returns null if no matching name was found in the logical tree.
The search direction for is toward child objects (down the tree); the search direction for the FindName methods is towards parent objects (up the tree).
The FindName methods are governed by the concept of a XAML namescope. Using FindName you are guaranteed that only one object of that name exists, because XAML namescopes enforce uniqueness. In contrast, ignores XAML namescope and might cross XAML namescope boundaries during the search. As such, there is no guarantee of uniqueness of the elementName name once boundaries are crossed. For more information about XAML namescopes, see WPF XAML Namescopes.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)