ExtensionMethods.FindAncestorOrSelf<TAncestorType> Method (Visual)

 

Finds the first ancestor of a given type in the logical or visual tree, or the object itself if it matches in type.

Namespace:   Microsoft.VisualStudio.PlatformUI
Assembly:  Microsoft.VisualStudio.Utilities (in Microsoft.VisualStudio.Utilities.dll)

public static TAncestorType FindAncestorOrSelf<TAncestorType>(
	this Visual obj
)
where TAncestorType : DependencyObject

Parameters

obj
Type: System.Windows.Media.Visual

The object at which to begin searching.

Return Value

Type: TAncestorType

The object itself, if it matches in type, else the first ancestor of type T in the parent chain of obj, or null if no ancestor is found.

Type Parameters

TAncestorType

The type of ancestor to find.

Return to top
Show: