Sowvik Roy
Sowvik Roy

Reputation: 913

How to remove white space in datagrid

Datagrid in Wpf

In this picture I had used Data grid with AutogeneratedColumn=false

Now how do I remove the white space in this Datagrid.

Upvotes: 0

Views: 1093

Answers (1)

Dennis
Dennis

Reputation: 37770

Set fill width (*) for the last column:

<DataGrid.Columns>
    <!-- The number of columns -->
    <!-- The last column -->
    <DataGridTextColumn Width="*"/>
</DataGrid.Columns>

Note, that if you want to share space fill between several columns, you have to set relative fill width:

<DataGrid.Columns>
    <!-- The number of columns -->
    <DataGridTextColumn Width="40*"/>
    <DataGridTextColumn Width="20*"/>
</DataGrid.Columns>

Upvotes: 2

Related Questions