CheckState CheckStateGetterMethod(object x)
        {
            System.Diagnostics.Debug.Assert(x is CheckedModelItem);

            CheckedModelItem o = (CheckedModelItem)x;
            CheckState       cs;

            if (o.IsChecked)
            {
                cs = CheckState.Checked;
            }
            else if (o.IsCheckedViaInheritance)
            {
                cs = CheckState.Indeterminate;
            }
            else
            {
                cs = CheckState.Unchecked;
            }
            if (GetterFilter != null)
            {
                return(GetterFilter(o, cs));
            }
            else
            {
                return(cs);
            }
        }
 void RefreshObjectAndChildrenRecurse(CheckedModelItem lvo)
 {
     foreach (CheckedModelItem child in mTreeView.GetChildren(lvo))
     {
         child.ResetParent(lvo);
         RefreshObjectAndChildrenRecurse(child);
     }
     mTreeView.RefreshObject(lvo);
 }
        public void UpdateCheckedByInheritance()
        {
            mIsCheckedViaInheritance = false;
            CheckedModelItem cmi = mParent;

            while (!mIsCheckedViaInheritance && cmi != null)
            {
                if (cmi.IsChecked)
                {
                    mIsCheckedViaInheritance = true;
                }
                cmi = cmi.mParent;
            }
        }
        CheckState CheckStateSetterMethod(object x, CheckState checkState)
        {
            System.Diagnostics.Debug.Assert(x is CheckedModelItem);

            bool             check = checkState == CheckState.Checked;
            CheckState       ret   = CheckState.Unchecked;
            CheckedModelItem o     = (CheckedModelItem)x;

            if (!o.IsCheckedViaInheritance)
            {
                if (check && !mAllowMultipleCheckedItems)
                {
                    foreach (CheckedModelItem lvo in mTreeView.CheckedObjects)
                    {
                        lvo.IsChecked = false;
                        RefreshObjectAndChildrenRecurse(lvo);
                    }
                }
                o.IsChecked = check;
                ret         = check ? CheckState.Checked : CheckState.Unchecked;
                if (check)
                {
                    if (SelectedObjectAdded != null)
                    {
                        SelectedObjectAdded(this, o);
                    }
                }
                else
                {
                    if (SelectedObjectRemoved != null)
                    {
                        SelectedObjectRemoved(this, o);
                    }
                }
            }
            else
            {
                ret = CheckState.Indeterminate;
            }
            RefreshObjectAndChildrenRecurse(o);
            return(SetterFilter != null?SetterFilter(o, ret) : ret);
        }
 public void ResetParent(CheckedModelItem parent)
 {
     mIsChecked = false;
     mParent = parent;
     UpdateCheckedByInheritance();
 }
 public CheckedModelItem( CheckedModelItem parent )
 {
     ResetParent( parent );
 }
 void RefreshObjectAndChildrenRecurse( CheckedModelItem lvo )
 {
     foreach ( CheckedModelItem child in mTreeView.GetChildren( lvo ) )
     {
         child.ResetParent( lvo );
         RefreshObjectAndChildrenRecurse( child );
     }
     mTreeView.RefreshObject( lvo );
 }
 public void ResetParent(CheckedModelItem parent)
 {
     mIsChecked = false;
     mParent    = parent;
     UpdateCheckedByInheritance();
 }
 public CheckedModelItem(CheckedModelItem parent)
 {
     ResetParent(parent);
 }