This may be more of a wpf question, so I apologize if this isn't the right place for it.
My root object is Employee which contains a property PayRecords which is a BusinessListBase(of PayRecords, PayRecord). In xaml I created a CslaDataProvider of type Employee. The xaml form binds several Employee properties and I want to bind the PayRecords property to a listbox.
I'd like the listbox to be group-able, sort-able, and filter-able. Can I create a csladataprovider and set it's source to the employee property PayRecords? I assume the csladataprovider supports sorting grouping and filtering?
In CSLA 3.x this is a little difficult because BusinessListBase inherits from BindingList<T>, not ObservableCollection<T>.
This really has nothing to do with the data provider model. The data provider just returns data.
It has to do with the sad fact that WPF doesn't fully support the BindingList<T> base class.
CSLA 4 switches the collections to inherit from ObservableCollection<T>, and so everything works automatically.
If you don't have the option to upgrade to CSLA for another few months what would my options be for sorting. I don't mind implementing an interface on my BusinessListBase classes.
Currently I'm simply trying to define a CollectionViewSource with a SortDescription in the XAML and the sort description is completely ignored when I examine the exposed view.
The only thing I have done so far is overridden the SupportsSortingCore property to return true. What should I implement to get the BindingListCollectionView to work with sorting?
There is no easy solution. You can google/bing for ideas on how to wrap a BindingList with an ObservableCollection. There are some answers out there, but none are perfect or easy.
I found this pretty helpful:
http://www.wpfmentor.com/2008/12/observable-collections-independent-of.html
But ultimately ended up completely abandoning the idea. For now I will just using SortedBindingList and handle the sort apply/reapply in code-behind (ew).
Copyright (c) Marimer LLC