Sorry if my answer got a little long, but don't blame me! Your question is also long.
Thus, MVVM is not meaningless.
A clear example is the addition of modal dialog support. the right way is to set up a dialog box and bind it to the view model. Getting it is hard to work.
Yes this is true. However, MVVM gives you the ability to separate the look of an interface from its logic. No one forces you to use it everywhere, and no one holds a gun against your forehead so that you create a separate ViewModel for everything.
Here is my solution for this specific example:
How the user interface handles a specific input is not one of the ViewModel business models. I would add code to the View.xaml.cs file, which creates a dialog box and sets the same instance of ViewModel (or something else, if necessary) as its DataContext.
To benefit from the MVVM template, you need to distribute the code in several places across all layers of the application. You should also use esoteric programming constructors such as lamba patterns and expressions.
Well, you do not need to use it in several places. Here is how I would decide:
- Add XAML to the view, and nothing in .xaml.cs
- Write each application logic (with the exception of things that will work directly with user interface elements) inside the ViewModel
- All the code that the user interface must execute, but which has nothing to do with business logic, is included in the .xaml.cs files.
I think that the goal of MVVM is primarily to separate the application logic and the specific user interface, which makes it easy to modify (or completely replace) the user interface.
I use the following principle: View can know and assume everything that it wants from the ViewModel, but the ViewModel cannot know ANYTHING about the view.
WPF provides a good binding model that you can use to achieve just that.
(BTW, patterns, and lambda expressions are not esoteric if used correctly, but if you do not want to, do not use them.)
Material that makes you look at the screen, scratching your head.
Yes, I know that feeling. Exactly what I felt when I first saw MVVM. But as soon as you get it, you will no longer feel bad.
I had a window that worked perfectly ...
Why would you put the ViewModel behind the about field? There is no point in this.
Most MVVM tools paint over dialogs and when they access them, these are just warning fields that do not require special interfaces or view models.
Yes, since the fact that the user interface element is in one window or in another window or is an orbiting Mars at the moment is not a problem for ViewModels. Separation of problems
EDIT:
Here is a very good video called Create your own MVVM environment . It is worth a look.