Last active
April 14, 2020 15:13
-
-
Save MwBakker/8a417c063c023d51a4b14556300a3479 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> SelectRecursive<T>(DependencyObject involvedView, Func<T, IEnumerable<T>> selector) | |
{ | |
int childrenCount = 0; | |
Application.Current.Dispatcher.Invoke(() => { childrenCount = VisualTreeHelper.GetChildrenCount(involvedView); }); | |
for (var i = 0; i < childrenCount; i++) | |
{ | |
foreach (T child in selector(involvedView).SelectRecursive(selector)) | |
{ | |
yield return child; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment