TreeHelper.

FindChildren<T>(DependencyObject, bool) Method

Summary

Analyzes both visual and logical tree in order to find all elements of a given type that are descendants of the source item.
Namespace
MahApps.Metro.Controls
Containing Type
TreeHelper

Syntax

public static IEnumerable<T> FindChildren<T>(this DependencyObject source, bool forceUsingTheVisualTreeHelper = false) 
    where T : DependencyObject

Type Parameters

Name Description
T The type of the queried items.

Parameters

Name Type Description
source DependencyObject The root element that marks the source of the search. If the source is already of the requested type, it will not be included in the result.
forceUsingTheVisualTreeHelper bool Sometimes it's better to search in the VisualTree (e.g. in tests)

Return Value

Type Description
IEnumerable<T> All descendants of source that match the requested type.