// Obtain folder check state for hierarchy folder mode. public Boolean?getFolderCheckState(BaseTreeNode treeNode) { if (treeNode.Children.Count < 1) { return(true); } else { CheckState firstItem = Column.GetCheckState(treeNode.Children[0]); for (int i = 1; i < treeNode.Children.Count; i++) { if (Column.GetCheckState(treeNode.Children[i]) != firstItem) { firstItem = CheckState.Indeterminate; break; } } switch (firstItem) { case CheckState.Checked: return(true); case CheckState.Unchecked: return(false); default: return(null); } } }
/// <summary> /// Toggle the check at the check box of the given cell /// </summary> /// <param name="rowObject"></param> /// <param name="column"></param> public virtual void ToggleSubItemCheckBox(object rowObject, OLVColumn column) { CheckState currentState = column.GetCheckState(rowObject); CheckState newState = CalculateToggledCheckState(column, currentState); SubItemCheckingEventArgs args = new SubItemCheckingEventArgs(column, this.ModelToItem(rowObject), column.Index, currentState, newState); this.OnSubItemChecking(args); if (args.Canceled) return; switch (args.NewValue) { case CheckState.Checked: this.CheckSubItem(rowObject, column); break; case CheckState.Indeterminate: this.CheckIndeterminateSubItem(rowObject, column); break; case CheckState.Unchecked: this.UncheckSubItem(rowObject, column); break; } }
/// <summary> /// Is there a check at the check box at the given cell /// </summary> /// <param name="rowObject"></param> /// <param name="column"></param> public virtual bool IsSubItemChecked(object rowObject, OLVColumn column) { if (column != null && rowObject != null && column.CheckBoxes) return (column.GetCheckState(rowObject) == CheckState.Checked); else return false; }
/// <summary> /// Is there a check at the check box at the given cell /// </summary> /// <param name="rowObject"></param> /// <param name="column"></param> public virtual bool IsSubItemChecked(object rowObject, OLVColumn column) { if (column == null || rowObject == null || !column.CheckBoxes) return false; return (column.GetCheckState(rowObject) == CheckState.Checked); }