Stretching columns to fill all available space of DataGrid

Since the vast majority of the answers I've found on this topic deal with XAML, here is a C# solution to set all columns to fill the available space in the datagrid.

    foreach (var column in this.datagrid.Columns)
    {
        column.Width = new DataGridLength(1, DataGridLengthUnitType.Star);
    }

Yes, I think you are looking for the AutoSizeMode property.

int n = grid.Columns.Count;
grid.Columns[n].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

Edit: Try setting the width to "*" as seen below. You'll have to do this in the code if your columns are auto-generated.

<DataGrid>
  <DataGrid.Columns>
    <DataGridTextColumn Width="Auto" />
    <DataGridTextColumn Width="*" />
  </DataGrid.Columns>
</DataGrid>