I've just finished reading another article on MVVM, and I'm becoming convinced that a lot of what I am reading is junk--even the articles published in well--respected magazines. Most of the implementations of MVVM that I have seen are just plain bad, and it has left me wondering whether anyone knows how to implement the pattern well.
Here's my gripe: Take a relatively simple app that has a main window and several views that it loads into that window. Some of the articles call these views 'workspaces', others call them 'task panels', or something similar. Now, take the simple task of loading one of these views into the main window. How do you do it in an MVVM app?
The article I just finished has the ViewModel load the view by using data binding. The view has a control with a content area, whose Content property is bound to a ViewModel property. To load a view, the ViewModel property is set to the View object, which is propagated to the main window by the data binding.
This approach initially looks pretty slick. There's no code-behind required, which the article's author takes great pride in. He also claims the main window, the View and the ViewModel are loosely coupled, because the Main window links to the ViewModel using data binding. I think he's dead wrong, and I don't care for his design at all.
For starters, if the ViewModel is
View Complete Post