I am trying to make a master-details form, with the master records bound to one binding source, and the details datagridview bound to a second binding source
It works pretty well, only the childBindingSource.SupportSorting
property is false.
masterBindingSource.SupportsSorting
is true. Is there a way I can get the childBindingSource
to support sorting - given that it is based on another binding source that does support sorting?
masterBindingSource.DataSource = GetBindingSource() // .SupportsSorting = true
childBindingSource.DataSource = masterBindingSource // .SupportsSorting = false
childBinding.DataMember = ChildItems
private BindingSource GetBindingSource()
{
DbSet<ContactEvent> dset = Db.ContactEvents;
IOrderedQueryable<ContactEvent> qry = dset.Where(p => p.Id > 0).OrderBy(x => x.Id);
qry.Load();
BindingList<ContactEvent> bindinglist = dset.Local.ToBindingList();
var bindingSource = new BindingSource();
bindingSource.DataSource = bindinglist;
return bindingSource;
}