Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
UltraTree PerformAutoResize Performance Issue
posted

I have an UltraTree in FreeForm style.

I have hundreds of nodes in the tree, and I have the UltraTree in a split container, so when I resize the split container I want to AutoSize all the nodes in the tree.

I wrote a recursive routine which resizes all columns in all nodes in the Ultra Tree , and it is very slow.

Calling  BeginUpdate and EndUpdate on the tree does not help.

I call it as AutoSizeTreeViewNodeColumns(null) and it recursively calls itself on all the children.

Calling PerformAutoSize(AutoSizeMode.VisibleNodes) does not help much and it doesn't work correctly if I call this routine in BeforeExpand, which is another place I call my recursive routine.

PolicyManagerTreeNode inherits from UltraTreeNode, but I don't have any special resize code in it.

Any help would be greatly appreciated. Thanks

 

   private void AutoSizeTreeViewNodeColumns(PolicyManagerTreeNode node)
        {
            if (node == null)
            {
                LeftTreeView.BeginUpdate();
                //LeftTreeView.Visible = false;
            }
         
            if (node == null)
            {

                foreach (PolicyManagerTreeNode pnode in LeftTreeView.Nodes)
                {
                    if (pnode.Override.ColumnSet != null)
                    {
                        foreach (UltraTreeNodeColumn column in pnode.Override.ColumnSet.Columns)
                        {
                            //column.PerformAutoResize();
                            column.PerformAutoResize(ColumnAutoSizeMode.AllNodes);
                        }
                    }
                    AutoSizeTreeViewNodeColumns(pnode);
                }
            }
            else
            {
                if (node.Override.ColumnSet != null)
                {
                    foreach (UltraTreeNodeColumn column in node.Override.ColumnSet.Columns)
                    {
                        //column.PerformAutoResize(ColumnAutoSizeMode.VisibleNodes);
                        column.PerformAutoResize(ColumnAutoSizeMode.AllNodes);
                    }
                }
                foreach (PolicyManagerTreeNode pnode in node.Nodes)
                {
                    AutoSizeTreeViewNodeColumns(pnode);
                }
            }
            if (node == null)
            {
                LeftTreeView.EndUpdate();
               //LeftTreeView.Visible = true;
            }
        }