标签:list int cat alc find etc end amp ++
public static List<T> FindVisualChild<T>(DependencyObject obj) where T : DependencyObject { try { List<T> TList = new List<T> { }; for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) { DependencyObject child = VisualTreeHelper.GetChild(obj, i); if (child != null && child is T) { TList.Add((T)child); List<T> childOfChildren = FindVisualChild<T>(child); if (childOfChildren != null) { TList.AddRange(childOfChildren); } } else { List<T> childOfChildren = FindVisualChild<T>(child); if (childOfChildren != null) { TList.AddRange(childOfChildren); } } } return TList; } catch (Exception ee) { } }
标签:list int cat alc find etc end amp ++
原文地址:https://www.cnblogs.com/RR-ghost/p/9772634.html