Exemplo n.º 1
0
        public static void RecheckChilds(this ISelectable obj)
        {
            bool SomeSelected    = false;
            bool SomeNotSelected = false;

            foreach (ISelectable child in obj.Childs())
            {
                if (child.IsSelectedInternal == true)
                {
                    SomeSelected = true;
                }
                if (child.IsSelectedInternal == false)
                {
                    SomeNotSelected = true;
                }
            }

            if (SomeSelected)
            {
                if (SomeNotSelected)
                {
                    obj.IsSelectedInternal = null;
                }
                else
                {
                    obj.IsSelectedInternal = true;
                }
            }
            else
            {
                obj.IsSelectedInternal = false;
            }

            obj.OnPropertyChanged("IsSelected");
        }
Exemplo n.º 2
0
        //
        // Must Call from IsSelected=>set
        //
        public static void OnChangeSelected(this ISelectable obj, bool?value)
        {
            foreach (ISelectable child in obj.Childs())
            {
                child.SetSelectedValue(value);
            }

            foreach (ISelectable parent in obj.Parents())
            {
                parent.RecheckChilds();
            }
        }