src/Misc/EFTools/EntityDesign/VisualStudio/ModelWizard/gui/DatabaseObjectTreeView.cs
// <summary>
//     Updates a parent node's Checked state recursively up the tree
//     according to the child's new Checked state.
//     Note: childNode could be any kind of node.
// </summary>
Updates a parent node's Checked state recursively up the tree
according to the child's new Checked state.
Note: childNode could be any kind of node.
Updates a parent node ' s Checked state recursively up the tree according to the child ' s new Checked state . Note : childNode could be any kind of node .
private static void UpdateParentNodeCheckedState(TreeNode childNode)
        {
            if (null == childNode
                || null == childNode.Parent)
            {
                return;
            }
            if (childNode.Checked
                && !childNode.Parent.Checked)
            {
                childNode.Parent.Checked = true;
                UpdateParentNodeCheckedState(childNode.Parent);
            }
            else if (!childNode.Checked
                     && childNode.Parent.Checked
                     &&
                     !childNode.Parent.Nodes.Cast<TreeNode>().Any(n => n.Checked))
            {
                childNode.Parent.Checked = false;
                UpdateParentNodeCheckedState(childNode.Parent);
            }
        }
private static void UpdateParentNodeCheckedState ( TreeNode childNode ) { if ( null == childNode || null == childNode . Parent ) { return ; } if ( childNode . Checked && ! childNode . Parent . Checked ) { childNode . Parent . Checked = true ; UpdateParentNodeCheckedState ( childNode . Parent ) ; } else if ( ! childNode . Checked && childNode . Parent . Checked && ! childNode . Parent . Nodes . Cast < TreeNode > ( ) . Any ( n => n . Checked ) ) { childNode . Parent . Checked = false ; UpdateParentNodeCheckedState ( childNode . Parent ) ; } }
Updates a parent node's Checked state recursively up the tree
according to the child's new Checked state.
Updates a parent node ' s Checked state recursively up the tree according to the child ' s new Checked state .
// no parent to update // child has been checked, ensure parent is checked // call recursively on the parent node's parent // child has been unchecked, scan through parent's children  // and see if any one is checked - if now none are then // uncheck parent // call recursively on the parent node's parent
childNode
TreeNode