Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

LogicalTreeHelper Class

Provides static helper methods for querying objects in the logical tree.

System.Object
  System.Windows.LogicalTreeHelper

Namespace:  System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)
public static class LogicalTreeHelper

The LogicalTreeHelper type exposes the following members.

  NameDescription
Public methodStatic memberBringIntoViewAttempts to bring the requested UI element into view and raises the FrameworkElement.RequestBringIntoView event on the target in order to report the results.
Public methodStatic memberFindLogicalNodeAttempts 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.
Public methodStatic memberGetChildren(DependencyObject)Returns the collection of immediate child objects of the specified object, by processing the logical tree.
Public methodStatic memberGetChildren(FrameworkContentElement)Returns the collection of immediate child objects of the specified FrameworkContentElement by processing the logical tree.
Public methodStatic memberGetChildren(FrameworkElement)Returns the collection of immediate child objects of the specified FrameworkElement by processing the logical tree.
Public methodStatic memberGetParentReturns the parent object of the specified object by processing the logical tree.
Top

The LogicalTreeHelper class provides methods that you can use to return child collections of objects, or specific objects from within subnodes of the logical tree. However, most of the object tree operations that you typically perform are also exposed by similar methods or properties on FrameworkElement or FrameworkContentElement. For example, try the following:

  • Instead of calling the static GetChildren method, which returns an enumerator for the logical child objects, use the dedicated collection exposed in the content model for that object. Nearly all objects that support a content model expose some property that contains the collection of child objects, and provides collection interface support directly on that collection.

  • Instead of calling the static FindLogicalNode method to obtain a child object by specifying its name, call the FrameworkElement.FindName or FrameworkContentElement.FindName method on specific objects.

LogicalTreeHelper is most useful for analysis scenarios where you are traveling up or down the logical tree recursively through multiple levels, and want to use a consistent approach for examining the various parent or child objects. In this case, you might be accessing a mixture of content models, and using the more content-model specific APIs would be too complex.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, 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)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.