Having said all of that, the Hub App Template does not have any classes that directly implement INotify Property Changed. Therefore, whenever new Sample Data Items are added or removed from the Items property, the Property Changed event will be fired by the collection on any user interface elements that bind to the Items collection.Unfortunately, this is a bit anticlimactic because we do not see this happen in the template as it stands right now.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.
In this lesson we talked about two very important ideas.
Hopefully you can see the larger role of MVVM and its influence on the Hub App Template.
I think of these are merely helpers to the main job of the View, and therefore I would classify them as part of the View itself. the View should merely observe the data exposed by the View Model.
In other words, it should watch the collections (or instances of objects) that were delivered by the View Model for changes and react to those changes. If an instance of an object that is part of a collection managed by the View Model is added, removed or updated, then the View should be notified of the change and the View should update itself with that change.
Fortunately, all of the “plumbing” required to make this work is baked into XAML.
But from your perspective, as the developer in order to make this work, your classes must implement the INotify Property Changed interface.
These have properties, but no real methods the implement logic. The view has the responsibility of presentation of the Model.
It does this through Binding, a core component of XAML through the binding syntax we’ve seen. We’ve seen examples of binding to data via the View Model, but later in this series we’ll see how the View binds to commands that are implemented in the View Model. It must load data into instances and collections of the Model classes to create an object graph.
At a high level, MVVM seeks to “separate concerns”, extracting code that is specific to presentation (the View, or rather, the XAML that defines the user interface), the code specific to the domain (the Model, or rather, the Sample Data Group and Sample Data Item classes), and the code that coordinates the activities of the model and provides the view with access to the model, (the View Model, or rather, the Sample Data Source class).