From what I've learned, you can't cast to BindingList, but rather you can wrap your result from the Linq query with a NEW BindingList. However, this doesn't work for me, because my Original Binding list has some events attached to it and i would like to maintain the same events in my LINQ result set.
I have my main BindingList collection called "Reports" (of type IReport). This collection is being registered to an event as following:
Reports.AddingNew += OnAddNewXReport;
now, when i would like to filter this big collection and extract only few matched items, i'm using Linq to get this matching list. To make this list a BindingList, i new to do the following:
var rs = Reports.Where(r => r.ReportType == ReportType.MyType).Select(o => (MyType) o);return new BindingList<MyType>(rs.ToList());
As you can see, this newly created collection, will not fire when new item is being added.
Does anyone has any idea how to resolve this? is there anyway to close the event subscription from the original BindingList to the "filtered" BindingList?
Thanks for the help