Wpf listview observablecollection not updating
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).Fortunately, all of the “plumbing” required to make this work is baked into XAML.
Hopefully you can see the larger role of MVVM and its influence on the Hub App Template.
(Just to provide a little guidance here, many believe this is an anti-pattern, or rather, “a bad idea”, called an Anemic Domain Model in which business logic is typically implemented in separate classes which transform the state of the domain objects.
But we’ll ignore that for now.) You can see examples of a typical model that utilizes MVVM in our Hub App Template: the Sample Data Item and Sample Data Group classes.
You might wonder whether the code behind (i.e., Hub cs) for the XAML is part of the View or the View Model.
After all, (1) it retrieves the appropriate data for the given View in the navigation Helper_Load State() method, and (2) it exposes the data retrieved from the View Model as a property to the XAML (i.e., default View Model).