MVVM Episode 1 - by _Maxxx_
MVVM seems, to me, to be the best way to develop applications that are both flexible - allowing changes to the GUI without complex rewrites, and allowing testing of the client logic without needing to resort to complex macros.
In this series of articles, I will present a small application in WPF, using an enhanced MVV pattern that I'm calling MVVM#.
So, what's different about my implementation? The main things are:
- Message Tracking: When a message is sent, we now know if it has been handled.
- Cancellable messages: A ViewModel can stop the message being sent further down the chain.
- Easy Peasy Modal Dialog windows
- No 'Main window': Everything is a View.
- Use of a Controller: The Controller controls the application.
- Easy to use Design Time Data for 'Blendability'
- Use of ViewData for binding data to a View, as well as a ViewModel to bind behaviour to a view.
In this article, I introduce the topics, and ideas, and explain some of the differences. In the second article, I'll show the way I set up any project using MVVM#, creating the base classes ready to begin the application specific development. In the third article, I'll add sufficient meat to the bones created in article 2 to give us a running application, albeit one that doesn't do too much. In the fourth article, I'll finish off the application to show a (small) but functioning application demonstrating some of the functions available.
Read More from: Original Source
Post Contributed by: Kunal Chowdhury
Kunal is the Site Admin and Contributor of Silverlight-Zone. He is a Software Engineer, Microsoft Silverlight MVP, Code Project Mentor and a Code Project MVP. He is also an active Author in SilverlightShow.net and a speaker in various community events. He works on Microsoft Platform and very passionate about Silverlight technology. He started his career in 2007 and achieved various awards during his professional life.
He shares his findings in his personal blog: http://www.kunal-chowdhury.com and he also tweets at: @kunal2383.