Now that I’ve covered some of the basic technological advances in WPF, mainly Data Binding, Commands, and Templating, it’s time to bring everything together, and demonstrate how this improves our jobs as developers.As I mentioned in the section on templating, WPF’s design strives to maintain a clear separation between presentation and logic. By separating presentation and logic, WPF creates opportunities for much greater degrees of flexibility in our applications. The Model-View-View Model pattern has one goal – to extend this same flexibility into our applications by creating a clean separation of concerns through our entire application.The only knowledge that the designer needs to know is what properties and commands are available, and their names – everything else is handled directly by the framework to make it work.This leads to a tremendous amount of flexibility in the View – the entire look and feel of an application can be changed at any time.This may be customer records in a database, or product information on a website, or anything else.In our case, it’s two classes, the Feed and the Feed Item class. The View is the entire user interface of your application – it’s everything the user’s interact with directly: every control, every button, every check box, every window.
The View can be modified by a designer with little or no programming experience, with no fear of breaking the logic.In MVVM, the View Model sits between the View and the Model, and basically acts similar to an Adapter – it translates the properties and methods of the Model to a form that can be directly used via Data Binding.The View Model also provides us a place to manage application state and logic.Let’s review our goal of maintaining a full separation of presentation and logic, this time just in terms of the View.When we create our user interface, we want to define what the user will see (presentation) without worrying about how the program works (logic).