Reputation: 895
I need a treeview control:
C#, .net 2.0, winforms (not wpf)
Upvotes: 3
Views: 14658
Reputation: 168
You can disable checkbox. First Set TreeView DrawMode property as OwnerDrawAll. Then Under DrawNode method check child node collection and set checked property as false ie.
private void xmlStructureTree_DrawNode(object sender, DrawTreeNodeEventArgs e)
{
if (e.Node.Nodes.Count != 0)
{
e.Node.Checked = false;
}
e.DrawDefault = true;
}
Upvotes: 0
Reputation: 38179
The WinForms tree view does not support mixed checkbox/non checkboxes nodes by default
You can enable CheckBoxes globally on the tree view and disable them on specific nodes using this method
Upvotes: 2