Esempio n. 1
0
        void UpdateCheckChildren(C1.Win.C1FlexGrid.Node node)
        {
            var checkState = node.Checked;

            foreach (C1.Win.C1FlexGrid.Node child in node.Nodes)
            {
                child.Checked = checkState;
                UpdateCheckChildren(child);
            }
        }
Esempio n. 2
0
        void UpdateCheckParent(C1.Win.C1FlexGrid.Node node)
        {
            // get this node's parent
            var parent = node.Parent;

            if (parent != null)
            {
                // count checked/unchecked children
                int cntChecked   = 0;
                int cntUnchecked = 0;
                int cntGrayed    = 0;
                foreach (C1.Win.C1FlexGrid.Node child in parent.Nodes)
                {
                    switch (child.Checked)
                    {
                    case C1.Win.C1FlexGrid.CheckEnum.Checked:
                        cntChecked++;
                        break;

                    case C1.Win.C1FlexGrid.CheckEnum.Unchecked:
                        cntUnchecked++;
                        break;

                    case C1.Win.C1FlexGrid.CheckEnum.Grayed:
                        cntGrayed++;
                        break;
                    }
                }

                // update parent's check state
                if (cntGrayed > 0 || (cntChecked > 0 && cntUnchecked > 0))
                {
                    parent.Checked = C1.Win.C1FlexGrid.CheckEnum.Grayed;
                }
                else if (cntChecked > 0 && cntUnchecked == 0)
                {
                    parent.Checked = C1.Win.C1FlexGrid.CheckEnum.Checked;
                }
                else if (cntUnchecked > 0 && cntChecked == 0)
                {
                    parent.Checked = C1.Win.C1FlexGrid.CheckEnum.Unchecked;
                }

                // update grandparent as well
                UpdateCheckParent(parent);
            }
        }