I\'ve got an AutoGenerateColumns WPF-DataGrid getting bound in code-behind to LINQ-to-SQL, which works fine.
But when I take off the AutoGenerateC
You're trying to put the column directly into the DataGrid (therefore it's trying to put the column in the grid's Items collection and that explains your error). You need to put it inside the Columns collection:
<toolkit:DataGrid x:Name="TheDataGrid"
CanUserAddRows="False"
AlternatingRowBackground="#ffffd"
CanUserSortColumns="true"
PreviewKeyDown="TheDataGrid_PreviewKeyDown"
AutoGenerateColumns="False"
RowEditEnding="TheDataGrid_RowEditEnding">
<toolkit:DataGrid.Columns>
<toolkit:DataGridTextColumn Header="Contact Name" Width="SizeToCells"
Binding="{Binding ContactName}"
IsReadOnly="False"/>
</toolkit:DataGrid.Columns>
</toolkit:DataGrid>