Wpf listview observablecollection not updating
Since that is not how the class is currently implemented, if you were to change the value of a property, such as the Title or Subtitle, while the app is running, you would NOT see the user interface update to reflect that change. Because the Sample Data Item class doesn’t have the ability (again, as it is currently implemented) to fire the Property Changed event and notify any observers of the change.
However, I believe I’ll demonstrate this when we build an application later in this series that works with observable data.
By implementing INotify Property Changed, your class says “You can observe me, I’ll let you know when I change.” I don’t have a complete example to show you, but let me show the simplest example I can think of to show how such an implementation might work:class Sample : INotify Property Changed By implementing INotify Property Changed we must agree to raise an event called Property Changed.
This is the fundamental wiring that allows other classes (like user interface classes) to be notified that changes to an instance of this class have occurred (so now go update yourself to reflect those changes in your user interface).
So, in other words, when a line of code like this is executed: Sample my Sample = new Sample();my Sample. the Property Changed event is fired and any class that listens to this event (like certain user interface classes / controls in the Phone API) will have an opportunity to refresh the data they display.In other words, there’s no functionality that requires we remove items from the collection, and therefore we don’t see it in play.