I'm working on a treeview with its CheckBoxes property set to true. I want the same functionality as in a CheckListBox in that if I check the box of a treenode, that node will be selected; and if I select a node, that node's checkbox will be checked. I'm not sure what event I need to hookup to do this. Please help. Thanks.
+1
A:
Try the following:
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
treeView1.SelectedNode.Checked = true;
}
This event is tied to the treeviews AfterSelect event
ferrari fan
2009-01-21 19:19:15
The problem with this approach is that if you keep clicking on one node, it'll only select it the very first time, and never unselect it when it's clicked again.
BFree
2009-01-21 19:22:08
Then just overwrite the onclick event as well to take care of that
ferrari fan
2009-01-21 19:26:38