标签:for sp c 工作 ad new r bs return
1.平时工作中用到的
private List<T> GetChildObjects<T>(DependencyObject obj) where T : FrameworkElement
{
DependencyObject child = null;
List<T> childList = new List<T>();
for (int i = 0; i <= VisualTreeHelper.GetChildrenCount(obj) - 1; i++)
{
child = VisualTreeHelper.GetChild(obj, i);
if (child is T)
{
childList.Add((T)child);
}
childList.AddRange(GetChildObjects<T>(child));
}
return childList;
}
标签:for sp c 工作 ad new r bs return
原文地址:http://www.cnblogs.com/wuyp-shodow/p/3990647.html