I start by calling MyTree.ExpandAll ( ExpandAllType.Always );
Then, using recursion and special .Tag values, I want to selectively collapse certain nodes using node.Expanded = false;
The ExpandAll () works fine (CollapseAll () also works fine). The node.Expanded does nothing.
My guess is that there is a flaw in the recursion logic because ExpandAll, CollapseAll, and the Expanded property set method all call into the same internal routine. If you post a brief code example demonstrating the problem you are having, we can try to help.
I have already validated my recursion.
private void CollapseTree ( TreeNodesCollection nodes ){ this.treeSystemManager.ExpandAll ( ExpandAllType.Always ); foreach ( UltraTreeNode node in nodes ) { if ( ( node.Tag != null ) && ( node.Tag is System.Boolean ) ) { bool bExpanded = (bool) node.Tag; if ( bExpanded ) { CollapseTree ( node.Nodes ); // Recurse if tag is true } else { //node.Expanded = false; // Does not work node.CollapseAll (); // Also does not work node.Update (); // Needed? } } else if ( node.Nodes.Count > 0 ) { CollapseTree ( node.Nodes ); // Recurse } }}
Well, duh!!!! My problem is the first line of code. After moving this line out of the method, everything works fine.