Export (0) Print
Expand All

LogicalTreeHelper Class

Provides static helper methods for logical tree element queries.

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

public static class LogicalTreeHelper
You cannot directly create an instance of this class in XAML.

The LogicalTreeHelper class provides methods that you can use to return child collections of elements, or specific elements from within subnodes of the logical tree. However, most of the element 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 elements, use the dedicated collection exposed in the content model for that element type. Nearly all elements that support a content model expose some property that contains the collection of child elements, and provides collection interface support directly on that collection.

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

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 elements or child elements. In this case, you might be accessing a mixture of content models, and using the more content-model specific members would be unweildy.

System.Object
  System.Windows.LogicalTreeHelper

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0

Community Additions

ADD
Show:
© 2014 Microsoft