using CollaborativePlatformMain.DFEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
namespace CollaborativePlatformMain.Util
{
///
///
/// 文件名(File Name): CollaborationUtil.cs
///
/// 描述(Description): 协同窗体后台工具类
///
/// 数据表(Tables): nothing
///
/// 作者(Author): Ou Rui Song
///
/// 日期(Create Date): 2024年4月20日15:24:29
///
/// 修改记录(Revision History):
/// R1:
/// 修改作者:
/// 修改日期:
/// 修改理由:
///
///
public class CollaborationUtil
{
///
/// 获得指定元素的所有子元素
///
///
///
///
public static List GetChildObjects(DependencyObject obj) where T : FrameworkElement
{
DependencyObject child = null;
List childList = new List();
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(child));
}
return childList;
}
///
/// 获取名字在集合中的下标
///
///
///
///
public static int GetIndexByTreeView(string name, List treeViews)
{
for (int i = 0; i < treeViews.Count; i++)
{
if (treeViews[i].Name.Equals(name))
{
return i;
}
}
return -1;
}
}
}