Using the TreeView control in WinForms, is there a property that can be set to hide the collapse-node icons for each node?
Also, how do I permanently expand all nodes in the TreeView?
Using the TreeView control in WinForms, is there a property that can be set to hide the collapse-node icons for each node?
Also, how do I permanently expand all nodes in the TreeView?
You would need to handle the OnBeforeExpand
event and set Cancel
to true
.
private void OnBeforeExpand(TreeViewCancelEventArgs e)
{
e.Cancel = true;
}
Keep in mind that this would prevent any tree node from expanding.
If you want to hide the "+/-" symbols, you should set the ShowPlusMinus
property to false
.
You can intercept the TreeView.BeforeCollapse
event
private void YourBeforeCollapseEventHandler(object sender, TreeViewCancelEventArgs e)
{
e.Cancel = true;
}