214 references to DataGridView
System.Windows.Forms (214)
System\Windows\Forms\Controls\DataGridView\DataGridViewRowCollection.cs (213)
13
/// <see cref="
DataGridView
"/> control.
132
DataGridView
?.OnRowUnshared(dataGridViewRow);
147
dataGridViewCell.OwningColumn =
DataGridView
.Columns[columnIndex];
157
DataGridView
?.OnRowUnshared(newDataGridViewRow);
177
if (
DataGridView
.DataSource is not null)
182
if (
DataGridView
.NoDimensionChangeAllowed)
192
Debug.Assert(
DataGridView
is not null);
194
if (
DataGridView
.Columns.Count == 0)
199
if (
DataGridView
.RowTemplate.Cells.Count >
DataGridView
.Columns.Count)
204
DataGridViewRow dataGridViewRow =
DataGridView
.RowTemplateClone;
205
Debug.Assert(dataGridViewRow.Cells.Count ==
DataGridView
.Columns.Count);
224
if (
DataGridView
.NewRowIndex != -1)
226
Debug.Assert(
DataGridView
.AllowUserToAddRowsInternal);
227
Debug.Assert(
DataGridView
.NewRowIndex == Count - 1);
234
DataGridView
.OnAddingRow(dataGridViewRow, rowState, checkFrozenState: true); // will throw an exception if the addition is illegal
242
dataGridViewCell.OwningColumn =
DataGridView
.Columns[columnIndex];
248
dataGridViewRow.HeaderCell.DataGridView =
DataGridView
;
257
DataGridView
._dataStoreAccessAllowed = false;
274
Debug.Assert(
DataGridView
is not null);
277
if (
DataGridView
.VirtualMode)
282
if (
DataGridView
.DataSource is not null)
287
if (
DataGridView
.NoDimensionChangeAllowed)
300
if (
DataGridView
.Columns.Count == 0)
305
if (
DataGridView
.DataSource is not null)
310
if (
DataGridView
.NoDimensionChangeAllowed)
321
Debug.Assert(
DataGridView
is not null);
328
if (
DataGridView
.Columns.Count == 0)
333
if (
DataGridView
.DataSource is not null)
338
if (
DataGridView
.NoDimensionChangeAllowed)
343
if (
DataGridView
.RowTemplate.Cells.Count >
DataGridView
.Columns.Count)
348
DataGridViewRow rowTemplate =
DataGridView
.RowTemplateClone;
349
Debug.Assert(rowTemplate.Cells.Count ==
DataGridView
.Columns.Count);
358
dataGridViewCell.OwningColumn =
DataGridView
.Columns[columnIndex];
368
if (
DataGridView
.NewRowIndex != -1)
370
Debug.Assert(
DataGridView
.AllowUserToAddRowsInternal);
371
Debug.Assert(
DataGridView
.NewRowIndex == Count - 1);
382
Debug.Assert(
DataGridView
is not null);
391
if (
DataGridView
.Columns.Count == 0)
396
if (dataGridViewRow.Cells.Count >
DataGridView
.Columns.Count)
406
if (
DataGridView
.NewRowIndex != -1)
408
Debug.Assert(
DataGridView
.AllowUserToAddRowsInternal);
409
Debug.Assert(
DataGridView
.NewRowIndex == Count - 1);
415
DataGridView
.CompleteCellsCollection(dataGridViewRow);
416
Debug.Assert(dataGridViewRow.Cells.Count ==
DataGridView
.Columns.Count);
417
DataGridView
.OnAddingRow(dataGridViewRow, dataGridViewRow.State, checkFrozenState: true); // will throw an exception if the addition is illegal
426
dataGridViewCell.OwningColumn =
DataGridView
.Columns[columnIndex];
434
dataGridViewRow.HeaderCell.DataGridView =
DataGridView
;
444
DataGridView
._dataStoreAccessAllowed = false;
462
if (
DataGridView
.DataSource is not null)
467
if (
DataGridView
.NoDimensionChangeAllowed)
481
Debug.Assert(
DataGridView
is not null);
483
if (
DataGridView
.NewRowIndex != -1)
485
Debug.Assert(
DataGridView
.AllowUserToAddRowsInternal);
486
Debug.Assert(
DataGridView
.NewRowIndex == Count - 1);
502
Debug.Assert(
DataGridView
is not null);
505
DataGridView
.OnAddingRow(rowTemplate, rowState, checkFrozenState: true); // will throw an exception if the addition is illegal
511
DataGridView
._dataStoreAccessAllowed = false;
533
if (
DataGridView
.DataSource is not null)
538
if (
DataGridView
.NoDimensionChangeAllowed)
548
if (
DataGridView
.NewRowIndex != -1)
550
Debug.Assert(
DataGridView
.AllowUserToAddRowsInternal);
551
Debug.Assert(
DataGridView
.NewRowIndex == Count - 1);
587
DataGridView
.OnAddingRow(rowTemplate, rowTemplateState, checkFrozenState: true); // Done once only, continue to check if this is OK - will throw an exception if the addition is illegal.
598
DataGridView
._dataStoreAccessAllowed = false;
602
DataGridView
.OnAddedRow_PreNotification(index); // Only calling this once instead of 'count' times. Continue to check if this is OK.
606
DataGridView
.OnAddedRow_PostNotification(index - (count - 1) + i);
616
DataGridView
.OnAddedRow_PreNotification(index);
620
DataGridView
.OnAddingRow(rowTemplate2, rowTemplateState, checkFrozenState: true); // done only once, continue to check if this is OK - will throw an exception if the addition is illegal
631
DataGridView
._dataStoreAccessAllowed = false;
635
DataGridView
.OnAddedRow_PreNotification(index); // Only calling this once instead of 'count-1' times. Continue to check if this is OK.
644
DataGridView
.OnAddedRow_PreNotification(index);
651
DataGridView
.OnAddedRow_PostNotification(index - (count - 1) + i);
671
Debug.Assert(
DataGridView
is not null);
686
dataGridViewCell.OwningColumn =
DataGridView
.Columns[columnIndex];
697
DataGridView
.OnAddingRow(dataGridViewRow, rowState, checkFrozenState: true); // will throw an exception if the addition is illegal
700
DataGridView
._dataStoreAccessAllowed = false;
716
Debug.Assert(
DataGridView
is not null);
718
if (
DataGridView
.NoDimensionChangeAllowed)
723
if (
DataGridView
.DataSource is not null)
728
if (
DataGridView
.NewRowIndex != -1)
730
Debug.Assert(
DataGridView
.AllowUserToAddRowsInternal);
731
Debug.Assert(
DataGridView
.NewRowIndex == Count - 1);
736
if (
DataGridView
.Columns.Count == 0)
744
DataGridView
.OnAddingRows(dataGridViewRows, checkFrozenStates: true); // will throw an exception if the addition is illegal
748
Debug.Assert(dataGridViewRow.Cells.Count ==
DataGridView
.Columns.Count);
754
dataGridViewCell.OwningColumn =
DataGridView
.Columns[columnIndex];
769
DataGridView
._dataStoreAccessAllowed = false;
780
DataGridView
.OnAddedRows_PreNotification(dataGridViewRows);
782
DataGridView
.OnAddedRows_PostNotification(dataGridViewRows);
787
if (
DataGridView
.NoDimensionChangeAllowed)
792
if (
DataGridView
.DataSource is not null)
794
if (
DataGridView
.DataConnection!.List is IBindingList list && list.AllowRemove && list.SupportsChangeNotification)
814
DataGridView
.OnClearingRows();
824
DataGridView
._dataStoreAccessAllowed = false;
831
DataGridView
.Columns.Count != 0 &&
832
DataGridView
.AllowUserToAddRowsInternal &&
835
DataGridView
.AddNewRow(false);
1353
Debug.Assert(
DataGridView
is not null);
1357
if (
DataGridView
.VirtualMode)
1362
if (
DataGridView
.DataSource is not null)
1367
DataGridViewRow dataGridViewRow =
DataGridView
.RowTemplateClone;
1377
if (
DataGridView
.DataSource is not null)
1382
if (
DataGridView
.NoDimensionChangeAllowed)
1392
if (
DataGridView
.DataSource is not null)
1407
if (
DataGridView
.NoDimensionChangeAllowed)
1412
if (
DataGridView
.Columns.Count == 0)
1417
if (
DataGridView
.RowTemplate.Cells.Count >
DataGridView
.Columns.Count)
1422
if (
DataGridView
.NewRowIndex != -1 && rowIndex == Count)
1425
Debug.Assert(
DataGridView
.AllowUserToAddRowsInternal);
1429
DataGridViewRow rowTemplate =
DataGridView
.RowTemplateClone;
1430
Debug.Assert(rowTemplate.Cells.Count ==
DataGridView
.Columns.Count);
1439
dataGridViewCell.OwningColumn =
DataGridView
.Columns[columnIndex];
1454
Debug.Assert(
DataGridView
is not null);
1467
if (
DataGridView
.NewRowIndex != -1 && rowIndex == Count)
1470
Debug.Assert(
DataGridView
.AllowUserToAddRowsInternal);
1474
if (
DataGridView
.Columns.Count == 0)
1479
if (dataGridViewRow.Cells.Count >
DataGridView
.Columns.Count)
1494
Debug.Assert(
DataGridView
is not null);
1498
Debug.Assert(!
DataGridView
.NoDimensionChangeAllowed);
1499
Debug.Assert(
DataGridView
.NewRowIndex == -1 || rowIndex != Count);
1506
if (
DataGridView
.Columns.Count == 0)
1511
if (dataGridViewRow.Cells.Count >
DataGridView
.Columns.Count)
1517
DataGridView
.CompleteCellsCollection(dataGridViewRow);
1518
Debug.Assert(dataGridViewRow.Cells.Count ==
DataGridView
.Columns.Count);
1519
DataGridView
.OnInsertingRow(rowIndex, dataGridViewRow, dataGridViewRow.State, ref newCurrentCell, true, 1, force); // will throw an exception if the insertion is illegal
1528
dataGridViewCell.OwningColumn =
DataGridView
.Columns[columnIndex];
1536
dataGridViewRow.HeaderCell.DataGridView =
DataGridView
;
1545
DataGridView
._dataStoreAccessAllowed = false;
1567
if (
DataGridView
.DataSource is not null)
1572
if (
DataGridView
.NoDimensionChangeAllowed)
1582
Debug.Assert(
DataGridView
is not null);
1599
if (
DataGridView
.NewRowIndex != -1 && indexDestination == Count)
1602
Debug.Assert(
DataGridView
.AllowUserToAddRowsInternal);
1618
DataGridView
.OnInsertingRow(indexDestination, rowTemplate, rowTemplateState, ref newCurrentCell, firstInsertion: true, count, force: false);
1625
DataGridView
._dataStoreAccessAllowed = false;
1630
DataGridView
.OnInsertedRow_PreNotification(indexDestination, count);
1634
DataGridView
.OnInsertedRow_PostNotification(indexDestination + i, newCurrentCell, i == count - 1);
1639
DataGridView
.OnInsertingRow(indexDestination, rowTemplate, rowTemplateState, ref newCurrentCell, firstInsertion: true, insertionCount: 1, force: false); // will throw an exception if the insertion is illegal
1643
DataGridView
._dataStoreAccessAllowed = false;
1657
DataGridView
.OnInsertedRow_PreNotification(indexDestination, 1);
1662
DataGridView
.OnInsertingRow(indexDestination + 1, rowTemplate2, rowTemplateState, ref newCurrentCell, false, count - 1, force: false);
1669
DataGridView
._dataStoreAccessAllowed = false;
1674
DataGridView
.OnInsertedRow_PreNotification(indexDestination + 1, count - 1);
1685
DataGridView
.OnInsertedRow_PreNotification(indexDestination + i, 1);
1693
DataGridView
.OnInsertedRow_PostNotification(indexDestination + i, newCurrentCell, i == count - 1);
1710
Debug.Assert(
DataGridView
is not null);
1720
dataGridViewCell.OwningColumn =
DataGridView
.Columns[columnIndex];
1731
DataGridView
.OnInsertingRow(indexDestination, dataGridViewRow, rowState, ref newCurrentCell, firstInsertion, 1, force: false); // will throw an exception if the insertion is illegal
1738
DataGridView
._dataStoreAccessAllowed = false;
1749
Debug.Assert(
DataGridView
is not null);
1764
if (
DataGridView
.NoDimensionChangeAllowed)
1769
if (
DataGridView
.NewRowIndex != -1 && rowIndex == Count)
1772
Debug.Assert(
DataGridView
.AllowUserToAddRowsInternal);
1776
if (
DataGridView
.DataSource is not null)
1781
if (
DataGridView
.Columns.Count == 0)
1789
DataGridView
.OnInsertingRows(rowIndex, dataGridViewRows, ref newCurrentCell); // will throw an exception if the insertion is illegal
1794
Debug.Assert(dataGridViewRow.Cells.Count ==
DataGridView
.Columns.Count);
1802
dataGridViewCell.OwningColumn =
DataGridView
.Columns[columnIndex];
1810
dataGridViewRow.HeaderCell.DataGridView =
DataGridView
;
1819
DataGridView
._dataStoreAccessAllowed = false;
1830
DataGridView
.OnInsertedRows_PreNotification(rowIndex, dataGridViewRows);
1832
DataGridView
.OnInsertedRows_PostNotification(dataGridViewRows, newCurrentCell);
1963
Debug.Assert(
DataGridView
is not null);
1980
int firstDisplayedRowIndex =
DataGridView
.FirstDisplayedRowIndex;
1989
DataGridView
.OnInsertedRow_PreNotification(rowIndex, 1);
1995
useRowShortcut =
DataGridView
.FirstDisplayedScrollingRowIndex == -1 &&
1996
GetRowsHeightExceedLimit(DataGridViewElementStates.Visible, 0, rowIndex,
DataGridView
.LayoutInfo.Data.Height);
1998
else if (
DataGridView
.FirstDisplayedScrollingRowIndex != -1 &&
1999
rowIndex >
DataGridView
.FirstDisplayedScrollingRowIndex)
2001
useRowShortcut = GetRowsHeightExceedLimit(DataGridViewElementStates.Visible, 0, rowIndex,
DataGridView
.LayoutInfo.Data.Height +
DataGridView
.VerticalScrollingOffset) &&
2002
firstDisplayedRowHeight <=
DataGridView
.LayoutInfo.Data.Height;
2008
DataGridView
.OnAddedRow_PreNotification(rowIndex);
2011
int displayedRowsHeightBeforeAddition = GetRowsHeight(DataGridViewElementStates.Visible) -
DataGridView
.VerticalScrollingOffset - dataGridViewRow.GetHeight(rowIndex);
2013
useRowShortcut =
DataGridView
.LayoutInfo.Data.Height < displayedRowsHeightBeforeAddition &&
2014
firstDisplayedRowHeight <=
DataGridView
.LayoutInfo.Data.Height;
2032
DataGridView
._dataStoreAccessAllowed = false;
2034
DataGridView
.OnRemovedRow_PreNotification(rowIndex);
2040
useRowShortcut =
DataGridView
.FirstDisplayedScrollingRowIndex == -1 &&
2041
GetRowsHeightExceedLimit(DataGridViewElementStates.Visible, 0, rowIndex,
DataGridView
.LayoutInfo.Data.Height + SystemInformation.HorizontalScrollBarHeight);
2043
else if (
DataGridView
.FirstDisplayedScrollingRowIndex != -1 &&
2044
rowIndex >
DataGridView
.FirstDisplayedScrollingRowIndex)
2047
int firstDisplayedRowIndex =
DataGridView
.FirstDisplayedRowIndex;
2053
useRowShortcut = GetRowsHeightExceedLimit(DataGridViewElementStates.Visible, 0, rowIndex,
DataGridView
.LayoutInfo.Data.Height +
DataGridView
.VerticalScrollingOffset + SystemInformation.HorizontalScrollBarHeight) &&
2054
firstDisplayedRowHeight <=
DataGridView
.LayoutInfo.Data.Height;
2080
DataGridView
.ResetUIState(useRowShortcut, computeVisibleRows);
2093
Debug.Assert(
DataGridView
is not null);
2096
DataGridView
.OnRowsRemovedInternal(rowIndex, rowCount);
2100
DataGridView
.OnRowsAddedInternal(rowIndex, rowCount);
2104
DataGridView
._dataStoreAccessAllowed = true;
2112
DataGridView
.OnInsertedRow_PostNotification(rowIndex, newCurrentCell, true);
2116
DataGridView
.OnAddedRow_PostNotification(rowIndex);
2124
DataGridView
.OnRemovedRow_PostNotification(dataGridViewRow, newCurrentCell);
2132
DataGridView
.OnClearedRows();
2139
DataGridView
.OnRowCollectionChanged_PostNotification(recreateNewRow, newCurrentCell.X == -1, cca, dataGridViewRow, rowIndex);
2146
if (dataGridViewRow.DataGridView !=
DataGridView
)
2168
if (
DataGridView
.NewRowIndex == index)
2170
Debug.Assert(
DataGridView
.AllowUserToAddRowsInternal);
2174
if (
DataGridView
.NoDimensionChangeAllowed)
2179
if (
DataGridView
.IsAccessibilityObjectCreated && OsVersion.IsWindows8OrGreater() && this[index] is DataGridViewRow row)
2190
if (
DataGridView
.DataSource is not null)
2192
if (
DataGridView
.DataConnection!.List is IBindingList bindingList && bindingList.AllowRemove && bindingList.SupportsChangeNotification)
2212
Debug.Assert(
DataGridView
is not null);
2213
Debug.Assert(!
DataGridView
.NoDimensionChangeAllowed);
2224
Debug.Assert(
DataGridView
is not null);
2225
DataGridView
.OnRemovingRow(index, out newCurrentCell, force);
2383
DataGridView
.SwapSortedRows(rowIndex1, rowIndex2);
2398
if (
DataGridView
.VirtualMode)
2401
int columnCount =
DataGridView
.Columns.Count;
System\Windows\Forms\Controls\DataGridView\DataGridViewRowCollection.RowComparer.cs (1)
22
_dataGridView = dataGridViewRows.
DataGridView
;