I have a WPF application in which I use entity framework with mysql connector/net to obtain data back. I have a combobox which is filled with items from a table. A datagrids itemssource property is binded to the combobox' selecteditem.staff property, which displays the data correctly. The problem is that I am unable to sort this data. If I bind the data directly to the datagrid, the sorting works correctly. However if I bind the data to the combobox, then bind the datagrid to the selected item of the grid, the sorting is lost.
Entity Framework Data Retrieval
private void RefreshOffices()
{
try
{
using (var context = new LDC_Entities())
{
cmbOffice.ItemsSource = context.Offices.Include("Staff.Roles").Include("Manager").ToList();
}
}
catch (Exception eX)
{
MessageBox.Show(String.Format("Unable to retrieve offices\nError:{0}", eX.Message),"Error",
MessageBoxButton.OK, MessageBoxImage.Error);
}
}
XAML Binding
Any help would be much appreciated, I have tried playing with the CanUserSort property of the datagrid to no success. I believe it is to do with how the datagrid is filled not by the selected item, but by the .staff collection of staff members.
Thanks in advance, Mike
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)