Hello,
Can anyone give me some pointers or an example on how to implement a sortable dynamic list using editablerootlistbase class? Prior to using the ERLB, I was implementing a sortable list (where objectList inherits from readonlylistbase) like this:
objectListBindingSource.DataSource = New SortedBindingList(Of objectInfo)(objectList)
Thanks,
Andrew
I am guessing this is not possible!
Well... in fact it is possible. Take a BrandColl ERLB made of Brand root objects:
Attach the BindingSource to the DataGridView
brandCollDGV.DataSource = brandCollBindingSource;
Now make the sorted list
_thisBrandColl = BrandColl.GetBrandColl();
brandCollBindingSource.RaiseListChangedEvents = false;
var sortedList = new SortedBindingList<Brand>(_thisBrandColl);
sortedList.ApplySort("BrandName", ListSortDirection.Ascending);
brandCollBindingSource.DataSource = sortedList;
brandCollBindingSource.RaiseListChangedEvents = true;
brandCollBindingSource.ResetBindings(false);
I'll be damn. Makes sense now as they all implemet IList(Of T).
Thanks,
Copyright (c) Marimer LLC