Click here to Skip to main content
15,895,011 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: MVVM design doubt Pin
ABitSmart25-Mar-09 21:02
ABitSmart25-Mar-09 21:02 
GeneralRe: MVVM design doubt Pin
anishkannan25-Mar-09 21:40
anishkannan25-Mar-09 21:40 
GeneralRe: MVVM design doubt Pin
ABitSmart25-Mar-09 21:52
ABitSmart25-Mar-09 21:52 
GeneralRe: MVVM design doubt Pin
anishkannan25-Mar-09 22:12
anishkannan25-Mar-09 22:12 
GeneralRe: MVVM design doubt Pin
ABitSmart25-Mar-09 22:16
ABitSmart25-Mar-09 22:16 
GeneralRe: MVVM design doubt Pin
anishkannan25-Mar-09 23:40
anishkannan25-Mar-09 23:40 
GeneralRe: MVVM design doubt Pin
ABitSmart26-Mar-09 0:22
ABitSmart26-Mar-09 0:22 
AnswerRe: MVVM design doubt Pin
Pete O'Hanlon25-Mar-09 23:02
mvePete O'Hanlon25-Mar-09 23:02 
ABitSmart has given you good advice.

In MVVM, your View never binds to the Model - it always binds to the ViewModel. There are many reasons for this, but the biggest one is that a well designed MVVM application should be testable without the view, so you can "poke" at the ViewModel to exercise it without having to mock up a view.

Similarly, your ViewModel shouldn't access the underlying data - that's the purpose of the model. The ViewModel exists solely to map between a view and a model - it's that simple. So, why do this? Why not map the view to the model? After all, you can test a model in isolation. Well, part of this is because the model exists solely to handle data - it shouldn't provide extensive validation of values, it shouldn't perform business logic, it shouldn't receive invalid values. The ViewModel isolates the model from potentially harmful changes due to user error.

I hope this helps to clarify some of the rationale behind MVVM, and why things are done where they are.

"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



GeneralRe: MVVM design doubt Pin
ABitSmart25-Mar-09 23:33
ABitSmart25-Mar-09 23:33 
Questionoff topic, identify correct forum help Pin
led mike26-Mar-09 8:17
led mike26-Mar-09 8:17 
QuestionSilverlight with WCF Services on IIS 7.0 Problems Pin
Miraxz25-Mar-09 12:17
Miraxz25-Mar-09 12:17 
QuestionRe: Silverlight with WCF Services on IIS 7.0 Problems Pin
Mark Salsbery25-Mar-09 13:35
Mark Salsbery25-Mar-09 13:35 
AnswerRe: Silverlight with WCF Services on IIS 7.0 Problems Pin
Miraxz25-Mar-09 19:05
Miraxz25-Mar-09 19:05 
GeneralRe: Silverlight with WCF Services on IIS 7.0 Problems Pin
Mark Salsbery26-Mar-09 6:05
Mark Salsbery26-Mar-09 6:05 
GeneralRe: Silverlight with WCF Services on IIS 7.0 Problems Pin
Miraxz26-Mar-09 16:53
Miraxz26-Mar-09 16:53 
GeneralRe: Silverlight with WCF Services on IIS 7.0 Problems Pin
Mark Salsbery26-Mar-09 18:12
Mark Salsbery26-Mar-09 18:12 
AnswerRe: Silverlight with WCF Services on IIS 7.0 Problems Pin
Miraxz26-Mar-09 17:18
Miraxz26-Mar-09 17:18 
GeneralRe: Silverlight with WCF Services on IIS 7.0 Problems Pin
Mark Salsbery26-Mar-09 18:08
Mark Salsbery26-Mar-09 18:08 
QuestionHow Do I Declare a New Property for a UserControl? Pin
That Asian Guy25-Mar-09 12:02
That Asian Guy25-Mar-09 12:02 
AnswerRe: How Do I Declare a New Property for a UserControl? Pin
ABitSmart25-Mar-09 17:47
ABitSmart25-Mar-09 17:47 
QuestionWPF: Combobox in TreeviewItem Pin
levik200625-Mar-09 5:57
levik200625-Mar-09 5:57 
AnswerRe: WPF: Combobox in TreeviewItem Pin
Insincere Dave25-Mar-09 6:45
Insincere Dave25-Mar-09 6:45 
GeneralRe: WPF: Combobox in TreeviewItem Pin
levik200625-Mar-09 7:10
levik200625-Mar-09 7:10 
QuestionTrackball.cs problem Pin
grJubei25-Mar-09 5:57
grJubei25-Mar-09 5:57 
QuestionMusic Player in WPF.. Pin
VisualLive25-Mar-09 0:06
VisualLive25-Mar-09 0:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.