Remove Default Empty Column From DataGrid. you can see the extra default column when you bind the data grid control. Sometime it is required to remove that extra empty column.
There are two situation when you are binding the datagrid control.
- AutoGenerateColumns is set to False
- AutoGenerateColumns is set to True
When you set the
AutoGenerateColumns to false then you can set the columns by using
either DataGridTextColumn, DataGridCheckBoxColumn or
DataGridTemplateColumn, in this case you know the last column of the
datagrid and what you have to do is to set the width of last column to
(*). When you have AutoGenerateColumns to false, the code is shown in
the List 1. here you can see that I have set the width of the last column which is the address column is set to (*).