Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

LogicalTreeHelper.FindLogicalNode Method

Finds and returns an element node that has the specified name. The search starts from the specified element and continues into subnodes.

Namespace: System.Windows
Assembly: PresentationFramework (in presentationframework.dll)

public static DependencyObject FindLogicalNode (
	DependencyObject logicalTreeNode,
	string elementName
public static DependencyObject FindLogicalNode (
	DependencyObject logicalTreeNode, 
	String elementName
public static function FindLogicalNode (
	logicalTreeNode : DependencyObject, 
	elementName : String
) : DependencyObject
You cannot use methods in XAML.



The element to start searching from. This object must be either a FrameworkElement or FrameworkContentElement type.


The name of the element node to find.

Return Value

The element with the matching name, if one is found; returns a null reference (Nothing in Visual Basic) if no matching name was found in the active namescope.

The methods FrameworkContentElement.FindName and FrameworkElement.FindName are superficially similar to FindLogicalNode, but operate by different logic:

  • The search direction for FindLogicalNode is toward child elements; the search direction for the FindName methods is toward parent elements.

  • The FindName methods are governed by the concept of a namescope. Using FindName you are guaranteed that only one element of that name exists, because namescopes enforce uniqueness. In contrast, FindLogicalNode ignores namescope and might cross namescope boundaries during the search. As such, there is no guarantee of uniqueness of name once boundaries are crossed. For more information about namescopes, see WPF Namescopes.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

© 2017 Microsoft