[DevExpress]TreeList展开指定类型级别的节点_.NET_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > .NET > [DevExpress]TreeList展开指定类型级别的节点

[DevExpress]TreeList展开指定类型级别的节点

 2013/8/7 13:08:24  YanZhiwei  博客园  我要评论(0)
  • 摘要:publicstaticvoidExpendPointTypeNode(TreeList_tree,NodeType_type){if(_tree==null)return;CrossThreadOperate.InvokeControlAction<TreeList>(_tree,t=>{foreach(TreeListNode_nodein_tree.Nodes){if((NodeType)_node.Tag==_type){ProcessNodeExpend(_node
  • 标签:list
class="csharpcode">public static void ExpendPointTypeNode(TreeList _tree, NodeType _type)
        {
            if (_tree == null) return;
            CrossThreadOperate.InvokeControlAction<TreeList>(_tree, t =>
            {
                foreach (TreeListNode _node in _tree.Nodes)
                {
                    if ((NodeType)_node.Tag == _type)
                    {
                        ProcessNodeExpend(_node);
                        continue;
                    }
                    ExpendPointTypeNode(_tree, _node, _type);
                }
            });
        }
        private static void ProcessNodeExpend(TreeListNode _node)
        {
            TreeListNode _currentNode = _node;
            while (_currentNode.ParentNode != null)
            {
                _currentNode.ParentNode.Expanded = true;
                _currentNode = _currentNode.ParentNode;
            }
        }
        private static void ExpendPointTypeNode(TreeList _tree, TreeListNode _node, NodeType _type)
        {
            CrossThreadOperate.InvokeControlAction<TreeList>(_tree, t =>
            {
                foreach (TreeListNode _n in _node.Nodes)
                {
                    if ((NodeType)_n.Tag == _type)
                    {
                        ProcessNodeExpend(_n);
                        continue;
                    }
                    ExpendPointTypeNode(_tree, _n, _type);
                }
            });
        }

使用:

CabTreeOperate.ExpendPointTypeNode(this.cabTreeControl.Tree, NodeType.Cab);

image

上一篇: 对象的操作 下一篇: Java生成xml文件
发表评论
用户名: 匿名