Follow up to my original question...attached is a sample project I did to do what I wanted by having InteractiveCheckBoxes = false and handling the AfterCheck event.
The problem I'm having is that even though I'm programmatically setting the child nodes' CheckState, the child nodes' AfterCheck event is raised with the TreeViewAdvAction set to ByMouse instead of Unknown. Here's the event handler:
private void treeViewAdv1_AfterCheck(object sender, TreeNodeAdvEventArgs e)
{
if (e.Action != TreeViewAdvAction.Unknown)
{
UpdateChildNodes(e.Node);
//UpdateParentNodes(e.Node);
}
}
private void UpdateChildNodes(TreeNodeAdv node)
{
// I can recursively checked all descendant nodes.
foreach (TreeNodeAdv childNode in node.Nodes)
{
childNode.CheckState = node.CheckState;
}
}
If you run the project, and check the root node, you can see all descendant nodes are checked, even though my UpdateChildNodes() does not recursively check all the child nodes. I'd expect TreeViewAdvAction is set to Unknown and the AfterCheck event raised by the child nodes will not execute UpdateChildNodes(). Perhaps I did something wrong?
WindowsFormsApplication2_40f0367a.zip