Easy MVVM Examples (In Extreme Detail) Available
Join the DZone community and get the full member experience.Join For Free
"This project will give you crash course on WPF MVVM that you can do in your lunch break! Everything you need to know about binding, INotifyPropertyChanged, Dependency Objects & Properites, POCO objects, Business Objects, Attached Properties and much more!
This is one of those helper articles for those that have been meaning to look into/learn/grok MVVM but haven't yet found the time too.
This article discusses the various methods and tricks used in MVVM to enable a developer to completely separate the user interface from the code.
Table of Contents
- Classic INotifyPropertyChanged
- DataContext Made in Code
- Using DependencyObject instead of INPC
- Using POCO objects with MVVM
- How to consume a closed Business Object (database layer, web service)
Model View ViewModel is the golden child of WPF, allowing a developer to completely separate their application code from any UI dependencies.
This means an application can be easily be re-skinned and it also makes an application much easier to test.
The View represents any front-end user interface controls (Window, Page, UserControl), the model represents the classes used in the application, and the ViewModel is the middle-man that requests, molds and exposes the data, as properties and commands.
This is article is linked to a TechNet sample project that you can download and explore. It covers many basic concepts of MVVM, and some of the common pitfalls and solutions.
Published at DZone with permission of Greg Duncan, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.