Created
May 22, 2015 09:11
-
-
Save jozsef-vesza/493c11178177aa2d0832 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<T> FindVisualChildren<T>(this DependencyObject e) where T : DependencyObject | |
{ | |
if (e == null) yield break; | |
VisualTreeHelper.GetChildren(e).Filter(child is T).Map(child => () | |
{ | |
if (children != null) | |
{ | |
yield return children; | |
} | |
foreach (var childOfChild in FindVisualChildren<T>(child)) | |
{ | |
yield return childOfChild; | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment