Replies: 1 comment
-
The source of "MVVM" is not MAUI. It may be some of the creators of WPF, but is now a movement with various community enforcers. The question of what is "true MVVM" doesn't seem within the remit of the MAUI repository to comment on. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This question on Stackoverflow is the poster child for a number of issues and questions surrounding MVVM and WPF.
1.) Please clearly and specifically define a ViewModel. The fact that a question such as the one posted even exists indicates a need for documentation at the source. For lack of anything better I personally define a ViewModel as a single object that is the source for rendering a View. I think of a ViewModel as something different than a Presentation Model, which is simply one of many objects that may be used to compose a ViewModel. More here.
2.) Please allow UserControls to participate in the Dependency Injection system. Currently if I inject an instance of my control into my page I have to manually deal with all the bindings. I want to be able to inject my ViewModel into my control, and inject my control into my page.
3.) A control is a reusable UI component. Reusable means there is no such thing as a top-level control or a bottom level control. A control should be consumable by any other control, which may be consumed by some other control, and so on. The assertion that the MVVM pattern works only at a single level in the control hierarchy implies that the MVVM pattern itself or its implementation is flawed. The pattern must be able to generalize across all levels of the UI hierarchy.
4.) As you might expect I disagree with the accepted answer to the question posted above. However the author makes a valid point:
5.) There needs to be a better way to communicate between ViewModels in a control hierarchy. I don't know exactly how this might be done. I suspect that just as controls are hierarchical objects, so too should ViewModels be hierarchical objects. An example of this can be found here. See also point 3.
Beta Was this translation helpful? Give feedback.
All reactions