Esempio n. 1
0
    void nodes_AfterCheck(object sender, ComboTreeNodeEventArgs e)
    {
        if (_cascadeCheckState)
        {
            _recurseDepth++;

            if (_recurseDepth == 1)
            {
                IEnumerator <ComboTreeNode> enumerator = ComboTreeNodeCollection.GetNodesRecursive(e.Node.Nodes, false);
                while (enumerator.MoveNext())
                {
                    if (_threeState)
                    {
                        enumerator.Current.CheckState = e.Node.CheckState;
                    }
                    else
                    {
                        enumerator.Current.Checked = e.Node.Checked;
                    }
                }

                ComboTreeNode parent = e.Node.Parent;
                while (parent != null)
                {
                    parent.CheckState = parent.GetAggregateCheckState();
                    parent            = parent.Parent;
                }
            }

            _recurseDepth--;
        }

        Invalidate();
        OnAfterCheck(e);
    }
Esempio n. 2
0
    /// <summary>
    /// Updates the check state of the parent nodes
    /// </summary>
    /// <param name="node"></param>
    private void SetCheckState(ComboTreeNode node)
    {
        node.CheckState = node.GetAggregateCheckState();

        if (node.Parent != null)
        {
            SetCheckState(node.Parent);
        }
    }