When binding WPF Toolkit DataGrid to SQL database through LINQ to SQL, how to correctly set binding source:
should it be some generic collection, filled and updated by LINQ to SQL queries or there is a possibility to directly connect DataGrid with LINQ to SQL queries?
As always, there is more than one way to skin a cat. However, I prefer to create a LINQ to SQL query and use the .ToList() to send the list to an ObservableCollection so you can monitor changes to your data and update the SQL Server database when your data is dirty. In other words, it would look something like this:
But of course, if you’re needing to perform filters, grouping, or sorting, I would send the query to a ListCollectionView instead. Which would look like this:
Hope that helps!