Is there a way to get notified when CompositeCollection's current location changes?
I need to have the CompositeCollection monitored by a CollectionView, any ideas are welcommed.
Is there a way to get notified when CompositeCollection's current location changes?
I need to have the CompositeCollection monitored by a CollectionView, any ideas are welcommed.
You can detect when the current item has changed by monitoring the
ICollectionView.CurrentChanged
event of your CollectionView. The following code works for me:When I change the selection in the ListBox, the message box displays.
Regarding filtering, sorting and grouping, as per Aron's answer these are not available on a view over a CompositeCollection. But for the record here are the ways you can detect changes for views that do support these features:
ObservableCollection<GroupDescription>
, so hook up a CollectionChanged event handler on the GroupDescriptions property.I ran into the same problem: I needed sorting of a CompositeCollection. I wrote the following class that solves the problem, at least for ObservableCollections of the same type.
The idea is to maintain the composite collection as an ordinary observable collection, and update it as the underlying collections change. Then the resulting collection (AllNodes) can be used in the user interface, and it supports CollectionView just fine.
You cant run a CollectionView on a copmposite collection, see here