Robin Maben
Robin Maben

Reputation: 23094

wpf remove datagrid left padding

Can somebody please shed some light on how to get rid of the mysterious padding on the left? I've tried numerous properties but none seem to affect.

Padding on the left

Upvotes: 16

Views: 8935

Answers (3)

John Myczek
John Myczek

Reputation: 12256

The padding you are referring to is probably the row header. To remove the row headers, you can set HeadersVisibility="Column" on the DataGrid.

I have seen cases where even with this property set to "Column" some of the rows still show a header. You can work around this by setting RowHeaderWidth="0" on the DataGrid.

Upvotes: 35

Pankaj Upadhyay
Pankaj Upadhyay

Reputation: 13594

There can be many reasons for this. Either the Template you are using has defined some setter property for the GridviewColoums or the GridViewColumns may be inheriting some settings defined in App.xaml or may be because of some settings in Theme (incase you are using one)

Upvotes: 0

Pavlo Glazkov
Pavlo Glazkov

Reputation: 20756

I cannot say where the extra padding is because you haven't provided any code. It might be somewhere in the style of the grid.

In such cases the Snoop utility can be very useful: http://snoopwpf.codeplex.com/

Upvotes: 2

Related Questions