views:

247

answers:

1

Hi,

I've got a strange problem with WPFToolkit DataGrid - after disabling AutoGenerateColumns, after adding only 1, narrow column, in the background of column headers appears full name of DataContext. It doesn't behave like a column - I can't neither resize or disable it.

Previously I didn't know about this problem, because I had few wide enough columns, but know this is a serius problem.

This is my code:

<Window.DataContext>
    <model:ShowUnitViewModel/>
</Window.DataContext>
<StackPanel>
    <toolkit:DataGrid ItemsSource="{Binding Items}">
        <toolkit:DataGrid.Columns>
            <toolkit:DataGridTextColumn Header="{x:Static lang:Unit.Name}" Binding="{Binding Path=Name}"/>
        </toolkit:DataGrid.Columns>
    </toolkit:DataGrid>
</StackPanel>
+1  A: 

Problem resolved.

The reason was wrong binding in DataGridColumnHeader template - I've created my own template with ContentPresenter without binding and works fine.

Previously was something like binding {Binding} in the content which caused the problem