Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 778
Robin Maben Avatar asked Jan 25 '11 14:01

Robin Maben


2 Answers

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.

like image 174
John Myczek Avatar answered Oct 25 '22 12:10

John Myczek


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/

like image 2
Pavlo Glazkov Avatar answered Oct 25 '22 14:10

Pavlo Glazkov