WPF data grid - Column Header not aligned with data rows

Posted by Pawan on Stack Overflow See other posts from Stack Overflow or by Pawan
Published on 2010-05-20T23:31:46Z Indexed on 2010/05/20 23:40 UTC
Read the original article Hit count: 376

Filed under:
|
|

Hi, I am using Datagrid in WPF. This is a very simple and basic implementation. I not using any styles. I created a simple datagrid :

<dg:DataGrid x:Name="dg" >
            </dg:DataGrid>

and populated it with data as:

 dg.ItemsSource = " H E L L O W O R L D!".Split();

Grid gets properly populated but the columnheader of the grid is drawn with some offset. Due to this my data and header are mis aligned. I tried searching for this over net but I haven't found anything. This seems to be a straightforward implementation which is working for everyone except me :(. Can anyone please tell me what might be going wrong? I have tried using different data sets and appyling some style to test this.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about wpfdatagrid