0

In the afterSelect event I want to expand a treeNode to get its children. I have tried the functions expand() and expandAll() but nothing happens. I am using c# with syncfusion.

The event:

void tvNavigation_AfterSelect(object sender, EventArgs e)
{
    var selNode = mFP.TreeViewPresenter.SelectedNode.Text;
    if (treeViewElements.Count > 0)
    {
        foreach (TreeNodeAdv tna in treeViewElements)
        {
            if (selNode == tna.Text)
            {
                tna.ExpandAll(); //does not expand
                var expNodes = (ArrayList)tna.Nodes.Clone();
                subTreeViewElements = expNodes.Cast<TreeNodeAdv>().ToList();
                break;
             }
         }
     }
}

Is this a bug of syncfusion?

freedomn-m
  • 27,664
  • 8
  • 35
  • 57
ninjaxelite
  • 1,139
  • 2
  • 20
  • 43

1 Answers1

0

Expand() and ExpandAll() function is working fine. Please check your node collection contains the TreeNodeAdv text while iteration. I have prepared a sample for your reference and it can be downloaded from the below location.

You can iterate through all the node in TreeViewAdv by using the below code snippet.

IEnumerable Collect(TreeNodeAdvCollection nodes) { foreach (TreeNodeAdv node in nodes) { yield return node;

            foreach (var child in Collect(node.Nodes))
                yield return child;
        }
    }

Sample Location : https://onedrive.live.com/redir?resid=7FCA130657D0D73E!135&authkey=!AH4aFdd3ZTd6T4c&ithint=file%2czip

kumaran619
  • 11
  • 3