internal void OnItemsCollectionChanged() { if (base.DataGridView != null) { DataGridViewRowCollection rows = base.DataGridView.Rows; int count = rows.Count; object[] items = ((DataGridViewComboBoxCell)this.CellTemplate).Items.InnerArray.ToArray(); for (int i = 0; i < count; i++) { DataGridViewComboBoxCell cell = rows.SharedRow(i).Cells[base.Index] as DataGridViewComboBoxCell; if (cell != null) { cell.Items.ClearInternal(); cell.Items.AddRangeInternal(items); } } base.DataGridView.OnColumnCommonChange(base.Index); } }
internal void OnItemsCollectionChanged() { // Items collection of the CellTemplate was changed. // Update the items collection of each existing DataGridViewComboBoxCell in the column. if (DataGridView != null) { DataGridViewRowCollection dataGridViewRows = DataGridView.Rows; int rowCount = dataGridViewRows.Count; object[] items = ((DataGridViewComboBoxCell)CellTemplate).Items.InnerArray.ToArray(); for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) { DataGridViewRow dataGridViewRow = dataGridViewRows.SharedRow(rowIndex); if (dataGridViewRow.Cells[Index] is DataGridViewComboBoxCell dataGridViewCell) { dataGridViewCell.Items.ClearInternal(); dataGridViewCell.Items.AddRangeInternal(items); } } DataGridView.OnColumnCommonChange(Index); } }
internal object GetComparedObject(int rowIndex) { if (dataGridView.NewRowIndex != -1) { Debug.Assert(dataGridView.AllowUserToAddRowsInternal); if (rowIndex == dataGridView.NewRowIndex) { return(max); } } if (customComparer is null) { DataGridViewRow dataGridViewRow = dataGridViewRows.SharedRow(rowIndex); Debug.Assert(dataGridViewRow is not null); Debug.Assert(sortedColumnIndex >= 0); return(dataGridViewRow.Cells[sortedColumnIndex].GetValueInternal(rowIndex)); } else { return(dataGridViewRows[rowIndex]); // Unsharing compared rows! } }