Udostępnij za pośrednictwem


ExtensionMethods.GetVisualOrLogicalParent(DependencyObject) Method

Definition

This uses the visual tree first, then diverts to the logical tree if the visual tree ends. This is necessary for the TabControl, where using either the logical tree or visual tree by themselves is insufficient.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Windows::DependencyObject ^ GetVisualOrLogicalParent(System::Windows::DependencyObject ^ sourceElement);
public static System.Windows.DependencyObject GetVisualOrLogicalParent (this System.Windows.DependencyObject sourceElement);
static member GetVisualOrLogicalParent : System.Windows.DependencyObject -> System.Windows.DependencyObject
<Extension()>
Public Function GetVisualOrLogicalParent (sourceElement As DependencyObject) As DependencyObject

Parameters

sourceElement
DependencyObject

The object to begin searching from.

Returns

The visual tree parent of the object, or the logical tree parent if the visual tree parent is null, or null if the logical tree parent is null.

Applies to