void CheckColumn_ValueChanged(object sender, EventArgs e) { if (m_isBatchSetting) { return; } SummaryRow sumRow = m_grid.GetSummaryRow(); if (sumRow != null) { List <string> sumColumnNames = new List <string>(); List <string> countColumnNames = new List <string>(); foreach (Cell cell in sumRow.Cells) { SummaryCell sumCell = cell as SummaryCell; if (sumCell != null) { if (sumCell.StatFunction == StatFunction.Sum) { sumColumnNames.Add(cell.ParentColumn.FieldName); } else if (sumCell.StatFunction == StatFunction.Count) { countColumnNames.Add(cell.ParentColumn.FieldName); } } } if (sumColumnNames.Count > 0 || countColumnNames.Count > 0) { ValueRow valueRow = m_grid.GetValueRow(); if (valueRow == null) { sumRow.Visible = false; valueRow = m_grid.AddValueRowToFixedFooter(); } bool allSelect = true; bool noneSelect = true; decimal[] sum = new decimal[sumColumnNames.Count]; for (int i = 0; i < sumColumnNames.Count; ++i) { sum[i] = 0; } int[] count = new int[countColumnNames.Count]; for (int i = 0; i < countColumnNames.Count; ++i) { count[i] = 0; } foreach (Xceed.Grid.DataRow row in m_grid.DataRows) { if (Convert.ToBoolean(row.Cells[m_selectColumnName].Value)) { for (int i = 0; i < sumColumnNames.Count; ++i) { decimal?d = ConvertHelper.ToDecimal(row.Cells[sumColumnNames[i]].Value); sum[i] += d.HasValue ? d.Value : 0; } for (int i = 0; i < countColumnNames.Count; ++i) { count[i] += 1; } noneSelect = false; } else { allSelect = false; } } for (int i = 0; i < sumColumnNames.Count; ++i) { valueRow.Cells[sumColumnNames[i]].Value = sum[i]; } for (int i = 0; i < countColumnNames.Count; ++i) { valueRow.Cells[countColumnNames[i]].Value = count[i]; } if (allSelect) { valueRow.Cells[m_selectColumnName].Value = true; } else if (noneSelect) { valueRow.Cells[m_selectColumnName].Value = false; } else { valueRow.Cells[m_selectColumnName].Value = null; } } } }