//===================================================================== /// <summary> /// This is used to refresh the item collection in each cell when the template column's collection /// changes. /// </summary> internal void OnItemsCollectionChanged() { DataGridViewRowCollection rows; BaseComboBoxCell cell; int count, idx; object[] items; if (base.DataGridView != null) { rows = base.DataGridView.Rows; count = rows.Count; items = this.ComboBoxCellTemplate.Items.InnerList.ToArray(); for (idx = 0; idx < count; idx++) { cell = rows.SharedRow(idx).Cells[base.Index] as BaseComboBoxCell; if (cell != null) { cell.Items.ClearInternal(); cell.Items.AddRangeInternal(items); } } // Notify the grid view of the change so that it can resize the column and its rows if necessary DataGridViewHelper.OnColumnCommonChange(base.DataGridView, base.Index); } }
//===================================================================== /// <summary> /// This is used to notify the data grid view of a change that may require it to resize the column and /// possibly the row. /// </summary> protected void OnCommonChange() { if (base.DataGridView != null && !base.DataGridView.IsDisposed && !base.DataGridView.Disposing) { if (base.RowIndex == -1) { DataGridViewHelper.OnColumnCommonChange(base.DataGridView, base.ColumnIndex); } else { DataGridViewHelper.OnCellCommonChange(base.DataGridView, base.ColumnIndex, base.RowIndex); } } }