Hi Peter,
You can select all the leaf nodes of the parent node by only selecting the parent node by handling the AfterSelect Event handler.
private void treeViewAdv1_AfterSelect(object sender, System.EventArgs e)
{
TreeNodeAdvCollection tn = new TreeNodeAdvCollection();
foreach (TreeNodeAdv n in this.treeViewAdv1.SelectedNodes)
{
this.AddChildren(tn, n);
}
foreach (TreeNodeAdv n in tn)
{
this.treeViewAdv1.SelectedNodes.Add(n);
}
}
private void AddChildren(TreeNodeAdvCollection tn, TreeNodeAdv n)
{
foreach (TreeNodeAdv child in n.Nodes)
{
tn.Add(child);
this.AddChildren(tn, child);
}
}
Please take a look at the attached sample and let me know if this helps you.
Thanks for your interest in Syncfusion products.
Regards,
Deepa.T.S
LeafNodes.zip