views:

132

answers:

2

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.

A: 

Check out this blog post.

http://sweux.com/blogs/smoura/index.php/wpf/2009/05/19/wpf-toolkit-datagrid-part-iii-playing-with-datagridcolumns-and-datagridcells/

Odi - Xceed
Hi Thanks for answering to my post. however I have already seen this blog and downloaded the sample code, but I still can not figure out cause of my problem.
Scooby
A: 

Hi, To give more detail about what exactly is happening, here is a sample output

 xxxxxxxxxxxxxxxHeader1              Header2
 xxxxx**Value1**       **Value2**

where 'x' represents blank space. datagrid's column header and the cells are misaligned. I am not using any styling or spacing for my data. If anyone could suggest what possibly might be going wrong that would be great!

Thanks

Scooby