Home DevExpress Tips How to expand/collapse the tree-node from DevExpress XtraTreeList
Author:

You can expand or collapse the DevExpress XtraTreeList tree node programatically using the example below. You might want to do in the instance where you have a popup and you want the user to have the option to expand, collapse, expand all or collapse all the treenode list.

Expand the selected treenode list:

private void mnuItemExpandLibrary1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)

{

    tlLibrary.FocusedNode.Expanded = true;

}

 

Expand All the child treenode list from the select parent node:

 

private void mnuItemExpandAllLibrary2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)

{

    tlLibrary.FocusedNode.ExpandAll();

}

 

Collapse the selected treenode list:

 

private void mnuItemCollapseLibrary1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)

{

    tlLibrary.FocusedNode.Expanded = false;

}      

 

Collapse all the treenode list:

 

private void mnuItemCollapseAllLibrary1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)

{           

    tlLibrary.CollapseAll();

}

 



Comments (0)
Write comment
Your Contact Details:
Comment:
Security
Please input the anti-spam code that you can read in the image.

"