protected override void OnAfterCheck(TreeViewEventArgs e)
        {
            base.OnAfterCheck(e);

            if (this.UseThreeStateCheckBoxes)
            {
                switch (e.Action)
                {
                case TreeViewAction.ByKeyboard:
                case TreeViewAction.ByMouse:
                {
                    if (e.Node is ThreeStateTreeNode)
                    {
                        ThreeStateTreeNode tn = e.Node as ThreeStateTreeNode;
                        tn.Toggle();
                    }

                    break;
                }

                case TreeViewAction.Collapse:
                case TreeViewAction.Expand:
                case TreeViewAction.Unknown:
                default:
                {
                    break;
                }
                }
            }
        }
Exemplo n.º 2
0
        private void UpdateParentNodeState(bool isStartingPoint)
        {
            ThreeStateTreeNode parent = this.Parent as ThreeStateTreeNode;

            if (parent != null)
            {
                Enumerations.CheckBoxState state = Enumerations.CheckBoxState.Unchecked;

                if (!isStartingPoint && (this.State == Enumerations.CheckBoxState.Indeterminate))
                {
                    state = Enumerations.CheckBoxState.Indeterminate;
                }
                else
                {
                    state = this.SiblingsState;
                }
                if (parent.State != state)
                {
                    parent.State   = state;
                    parent.Checked = (state != Enumerations.CheckBoxState.Unchecked);
                    parent.UpdateParentNodeState(false);
                }
            }
        }