35 writes to DataSource
System.Windows.Forms (1)
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (1)
14910
private void OnDataSourceDisposed(object? sender, EventArgs e) =>
DataSource
= null;
System.Windows.Forms.Design (3)
System\Windows\Forms\Design\DataGridViewColumnCollectionDialog.cs (1)
1105
_dataGridViewPrivateCopy.
DataSource
= dataGridView.DataSource;
System\Windows\Forms\Design\DataGridViewDesigner.cs (2)
75
Control.
DataSource
= value;
314
dataGridView.
DataSource
= null;
System.Windows.Forms.Design.Tests (1)
System\Windows\Forms\Design\DataGridViewDesignerTests.cs (1)
85
_dataGridView.
DataSource
= dataSource;
System.Windows.Forms.Tests (25)
System\Windows\Forms\DataGridViewCellTests.cs (7)
200
DataSource
= new[] { new { Name = "Name" } }
843
DataSource
= new[] { new { Name = "Name" } }
879
DataSource
= new[] { new { Name = "Name" } }
4046
DataSource
= new[] { new { Name = "Name" } }
4089
DataSource
= new[] { new { Name = "Name" } }
4354
DataSource
= new[] { new { Name = "Name" } }
5145
DataSource
= new[] { new { Name = "Name" } }
System\Windows\Forms\DataGridViewHeaderCellTests.cs (2)
2413
DataSource
= new[] { new { Name = "Name" } }
3679
DataSource
= new[] { new { Name = "Name" } }
System\Windows\Forms\DataGridViewRowTests.cs (8)
108
DataSource
= new[] { new { Name = "Name" } }
326
DataSource
= new[] { boundObject }
353
DataSource
= new[] { boundObject }
941
DataSource
= new[] { new { Name = "Name" } }
1871
DataSource
= new[] { new { Name = "Name" } }
2340
DataSource
= new[] { new { Name = "Name" } }
4332
DataSource
= new[] { new { Name = "Name" } }
4457
DataSource
= new[] { new { Name = "Name" } }
System\Windows\Forms\DataGridViewTests.cs (8)
2810
control.
DataSource
= bindingSource;
2829
control.
DataSource
= bindingSource;
2851
control.
DataSource
= bindingSource1;
2857
control.
DataSource
= bindingSource2;
3209
_dataGridView.
DataSource
= new();
3213
_dataGridView.
DataSource
= new();
4041
_dataGridView.
DataSource
= bindingSource1;
4046
_dataGridView.
DataSource
= bindingSource2;
System.Windows.Forms.UI.IntegrationTests (3)
DataGridViewTests.cs (3)
27
dataGridView.
DataSource
= dataTable;
56
dataGridView.
DataSource
= bindingSource;
106
dataGridView.
DataSource
= dataTable;
TestPassApp (2)
DataBindingExample.cs (1)
40
dataGridView1.
DataSource
= new List<Student>
DataControls.cs (1)
32
dataGridView2.
DataSource
= bindingSource1;
80 references to DataSource
System.Windows.Forms (56)
System\Windows\Forms\Controls\DataGridView\DataGridView.cs (11)
13
[ComplexBindingProperties(nameof(
DataSource
), nameof(DataMember))]
656
if (
DataSource
is not null)
666
internal bool AllowUserToAddRowsInternal =>
DataSource
is null
694
internal bool AllowUserToDeleteRowsInternal =>
DataSource
is null
1390
if (
DataSource
is not null)
1894
DataConnection.SetDataConnection(
DataSource
, value);
1918
if (value !=
DataSource
)
1920
if (
DataSource
is Component oldDataSource)
2915
|| ((VirtualMode ||
DataSource
is not null) && IsCurrentRowDirty)
3182
if (
DataSource
is not null)
3890
if (VirtualMode ||
DataSource
is not null)
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (24)
1542
if (
DataSource
is not null
3184
if (
DataSource
is not null || VirtualMode)
3198
if (
DataSource
is not null)
10447
Debug.Assert(
DataSource
is not null, "this method should only be called when we have a data connection");
11140
if (AutoGenerateColumns &&
DataSource
is not null)
11458
DataConnection.SetDataConnection(
DataSource
, DataMember);
13250
if (
DataSource
is not null && !_dataGridViewOper[OperationInRefreshColumns])
13279
if (
DataSource
is not null && !_dataGridViewOper[OperationInRefreshColumns])
13324
if (
DataSource
is not null && e.Column.DataPropertyName.Length != 0 && !_dataGridViewOper[OperationInRefreshColumns])
13328
else if (
DataSource
is not null && e.Column.DataPropertyName.Length == 0)
13654
if ((
DataSource
is null)
13655
|| (
DataSource
is not null
14787
if (
DataSource
is not null)
17669
if (VirtualMode ||
DataSource
is not null)
18300
if (VirtualMode ||
DataSource
is not null)
19080
if (
DataSource
is not null && _ptCurrentCell.X >= 0 && AllowUserToAddRowsInternal && NewRowIndex == _ptCurrentCell.Y)
19957
if (
DataSource
is not null)
25442
if (
DataSource
is not null && dataGridViewCols[j].DataPropertyName.Length != 0)
25449
if (
DataSource
is not null)
28188
if (
DataSource
is not null)
28216
Debug.Assert(!(comparer is not null &&
DataSource
is not null));
28239
if (visibleFrozenRows > 0 &&
DataSource
is null)
28270
if (
DataSource
is null)
28327
if (
DataSource
is null)
System\Windows\Forms\Controls\DataGridView\DataGridViewBand.cs (1)
781
(DataGridView.VirtualMode || DataGridView.
DataSource
is not null) &&
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (3)
1421
(DataGridView.VirtualMode || DataGridView.
DataSource
is not null))
1558
&& (DataGridView.VirtualMode || DataGridView.
DataSource
is not null)
2369
(DataGridView.VirtualMode || DataGridView.
DataSource
is not null))
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.cs (3)
1217
if (DataGridView.VirtualMode || DataGridView.
DataSource
is not null)
1245
DataGridView.
DataSource
is not null &&
1251
if (DataGridView.
DataSource
is not null || DataGridView.VirtualMode)
System\Windows\Forms\Controls\DataGridView\DataGridViewRowCollection.cs (14)
177
if (DataGridView.
DataSource
is not null)
282
if (DataGridView.
DataSource
is not null)
305
if (DataGridView.
DataSource
is not null)
333
if (DataGridView.
DataSource
is not null)
462
if (DataGridView.
DataSource
is not null)
533
if (DataGridView.
DataSource
is not null)
723
if (DataGridView.
DataSource
is not null)
792
if (DataGridView.
DataSource
is not null)
1362
if (DataGridView.
DataSource
is not null)
1377
if (DataGridView.
DataSource
is not null)
1392
if (DataGridView.
DataSource
is not null)
1567
if (DataGridView.
DataSource
is not null)
1776
if (DataGridView.
DataSource
is not null)
2190
if (DataGridView.
DataSource
is not null)
System.Windows.Forms.Design (17)
System\Windows\Forms\Design\DataGridViewAddColumnDialog.cs (2)
710
if (_liveDataGridView.
DataSource
is not null)
715
currencyManager = BindingContext?[_liveDataGridView.
DataSource
, _liveDataGridView.DataMember] as CurrencyManager;
System\Windows\Forms\Design\DataGridViewColumnCollectionDialog.cs (1)
1105
_dataGridViewPrivateCopy.DataSource = dataGridView.
DataSource
;
System\Windows\Forms\Design\DataGridViewColumnDataPropertyNameEditor.cs (1)
38
object? dataSource = dataGridView.
DataSource
;
System\Windows\Forms\Design\DataGridViewDesigner.cs (13)
60
get => Control.
DataSource
;
63
if (Control is { AutoGenerateColumns: true,
DataSource
: null } dataGridView && value is not null)
128
dataGridView.AutoGenerateColumns = dataGridView.
DataSource
is null;
222
if (dataGridView.
DataSource
is not null)
224
newCM = (CurrencyManager?)dataGridView.BindingContext?[dataGridView.
DataSource
, dataGridView.DataMember];
253
if (dataGridView.AutoGenerateColumns && dataGridView.
DataSource
is not null)
261
if (dataGridView.
DataSource
is null)
291
if (e.Component is not null && e.Component == dataGridView.
DataSource
)
384
Debug.Assert(dataGridView.
DataSource
is null || _currencyManager is not null, "if we have a data source we should also have a currency manager by now");
523
if (dataGridView.
DataSource
is ISupportInitializeNotification { IsInitialized: false })
561
Debug.Assert(dataGridView.
DataSource
is null || _currencyManager is not null, "if we have a data source we should also have a currency manager by now");
619
if (dataGridView.
DataSource
is not null)
699
private bool ShouldSerializeDataSource() => Control.
DataSource
is not null;
System.Windows.Forms.Design.Tests (2)
System\Windows\Forms\Design\DataGridViewDesignerTests.cs (2)
96
_dataGridView.
DataSource
.Should().BeSameAs(dataSource);
106
_dataGridView.
DataSource
.Should().BeNull();
System.Windows.Forms.Tests (5)
System\Windows\Forms\DataGridViewTests.cs (5)
2831
Assert.Equal(bindingSource, control.
DataSource
);
2835
Assert.Null(control.
DataSource
);
2853
Assert.Equal(bindingSource1, control.
DataSource
);
2859
Assert.Equal(bindingSource2, control.
DataSource
);
2867
Assert.Equal(bindingSource2, control.
DataSource
);