I have successfully set up a WPF Datagrid with the March 2009 WPF Toolkit, created LINQ-to-SQL classes from the Northwind database, bound the WPF grid with this code:
var customers = from c in _db.Customers
select c;
TheDataGrid.ItemsSource = customers;
I can move columns from left to right, got delete columns to work, etc.
However, when I click on a column header to sort it, I get about 20 pairs of errors in my Output window, it looks as if there are a pair of errors for each column:
System.Windows.Data Error: 1 : Cannot create default converter to perform 'two-way' conversions between types 'System.Data.Linq.EntitySet`1[TestDataGrid566.Model.Order]' and 'System.String'. Consider using Converter property of Binding. BindingExpression:Path=Orders; DataItem='Customer' (HashCode=4925117); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='System.Data.Linq.EntitySet`1[TestDataGrid566.Model.Order]' BindingExpression:Path=Orders; DataItem='Customer' (HashCode=4925117); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
When I created the LINQ-to-SQL classes, I simply dragged all the tables from the database to the model designer and saved, so it the classes are all default code.
What are these errors telling me? Did I simply not set up the LINQ-to-SQL classes correctly or is this pointing to something deeper?