MemberListWindow Validator
This commit is contained in:
29
WGneu/Utils.cs
Normal file
29
WGneu/Utils.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
|
||||
namespace WGneu
|
||||
{
|
||||
class Utils
|
||||
{
|
||||
public static IEnumerable<T> FindVisualChilds<T>(DependencyObject depObj) where T : DependencyObject
|
||||
{
|
||||
if (depObj == null)
|
||||
yield return (T)Enumerable.Empty<T>();
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
|
||||
{
|
||||
DependencyObject ithChild = VisualTreeHelper.GetChild(depObj, i);
|
||||
if (ithChild == null)
|
||||
continue;
|
||||
if (ithChild is T t)
|
||||
yield return t;
|
||||
foreach (T childOfChild in FindVisualChilds<T>(ithChild))
|
||||
yield return childOfChild;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user