I've written 1 WPF app. A pretty simple app. It works great and is being used heavily as a LOB app today. Now I'm going to start work on a major re-write of an old VB6 app, and will make it into a WPF app as well. When working on the first app I learned of the INotifyPropertyChanged interface, and how vital it is to WPF/Silverlight data binding. My concern, now, is that quite some time ago I wrote a WCF service which is meant to replace the old middle-tier component I wrote in VB6 many years ago, for the old VB6 app. The WCF service I wrote returns ADO.NET datasets, because honestly I've been working with those for years and am comfortable with them. However, now that I'm beginning to work on this new app, I'm very concerned about my WCF service, since ADO.NET datasets don't implement the INotifyPropertyChanged interface.
So I've started looking at other things. Right now I'm looking at Entity Framework. I'm using Julia Lerman's book, "Programming Entity Framework: Second Edition", and it really looks promising. I've working through her example of a WPF app, which uses a EDM assembly she wrote in a previous chapter. Including references to the assemblies gives me CollectionViewSource's, and at least to me, it appears as though they act much the same way that the INotifyPropertyChanged interface does.
So my question is this: does the CollectionViewSource class implement the INotifyPropertyChanged interface? I've tried looking at the MSDN documentation, and it doesn't say so, directly, but I'm wondering if the DependencyObject class CollectionViewSource inherits from either duplicates the same functionality as the INotifyPropertyChanged interface, or does CollectionViewSource implement it?
You'll notice the MSDN doc on CollectionViewSource contains this as the class declaration:
Public Class CollectionViewSource _ Inherits DependencyObject _ Implements ISupportInitialize, IWeakEventListener
Neither it nor its base classes implement INotifyPropertyChanged. When you bind to the
View of the CollectionViewSource, you must call its
Refresh() method yourself when the underlying collection changes. If you change properties (such as sorting and grouping) of the CVS, Refresh is called automatically.
just to mention a little detail to Rod answer:
when adding or removing an item to collection, the items goes through any filter, grouping, sorting, etc.
But when a property of an existing item changes, then, you have to handle that by yourself to update filters, grouping, etc.
At this point, the solution of the Refresh() works BUT, can bring very bad user's experience since the whole collection get refreshed.
One solution is to simulate an remove/insert of the item. See my post fore more details.