Hi,
I have a WPF ListView bound to a CollectionViewSource. The source of that is bound to a property, which can change if the user selects an option.
When the list view source is updated due to a property changed event, everything updates correctly, but the view is not refreshed to take into account any changes in the CollectionViewSource filter.
If I attach a handler to the Changed event that the Source property is bound to I can refresh the view, but this is still the old view, as the binding has not updated the list yet.
Is there a decent way to make the view refresh and re-evaluate the filters when the source changes?
Cheers
-
Are you changing the actual collection instance assigned to the
CollectionViewSource.Source
, or are you just firingPropertyChanged
on the property that it's bound to?If the
Source
property is set, the filter should be recalled for every item in the new source collection, so I'm thinking something else is happening. Have you tried settingSource
manually instead of using a binding and seeing if you still get your behavior?Edit:
Are you using
CollectionViewSource.View.Filter
property, or theCollectionViewSource.Filter
event? TheCollectionView
will get blown away when you set a newSource
, so if you had aFilter
set on theCollectionView
it won't be there anymore.Steve : Yes, I am changing the collection, and the items in the list view are updated reflecting the new collection. However filter is not re-evaluated. Doing it manually didn't help: ((CollectionViewSource)this.Resources["logEntryViewSource"]).Source = _application.CurrentLog.Entries.ObservableCollection
0 comments:
Post a Comment