DataGridWhen Binding datatable,
Datagrid.Itemsource=dt.DefaultView;
DataGRID will find many lines.
Solution 1 is as follows:
The operation of CanUserAddRows attribute of Datagrid is OK.
<DataGrid CanUserAddRows="False"../>
takeCanUserAddRows
AssignmentFalse
,Otherwise, an extra row will be generated automatically, even thoughItemSource
BoundList
Acount
It’s 0. Set to false can avoid this problem.True
,Cooperate with each otherDataGridCheckBoxColumn
It’s even more strange. If the checkbox on the last line is checked, then clicking on any of the other lines will generate an extra line.
Solution 2 is as follows:
//Does not display the last row blank of dataGridView1. dataGridView1.AllowUserToAddRows = false; It can be added directly to the LODE event.