i have binded itemsource to Datatable for Datagrid . it shows extra columns how to remove it
My code :
If you want to:
you need to set "1*" to the last column only. Please:
1) Add the event handler to .xaml
2) Add the following code to .xaml.cs
private void dataGrid_AutoGeneratedColumns(object sender, EventArgs e)
{
int i = ((DataGrid)sender).Columns.Count;
DataGridColumn column = ((DataGrid)sender).Columns[i - 1];
column.Width = new DataGridLength(1, DataGridLengthUnitType.Star);
}