Where does the presentation logic go for the View-Model-ViewModel template?
In a View-Model-ViewModel, actions are essentially performed using a view bound to a view. However, where would the "presentation logic" go since the code behind was not used, and there is no link or knowledge of the control that called it in view mode?
For example, what if I want to animate another control when a button is pressed. Will this continue in code?
a source to share
To decipher Justin Niessner's comment , I would use a trigger to achieve this animation since all UIs are linked.
Think about it:
- Where would you put the code so that when someone hovers over a button, it lights up?
- How about a code to "click" this button when pressed?
These and your question are all theme options, so I would say do it in the GUI.
However, there is one exception to this rule. If "animation" is animation handling, then it might be worth binding to a ViewModel so that the ViewModel can control how long the animation runs when it processes something. Otherwise, do it in the GUI.
EDIT: Based on your comment. So, the animation should disable the property on the ViewModel, not the button click event. The click should start processing in the ViewModel with the command, and the execution code for that command should set the processing flag property in the ViewModel. The view can then bind to this processing flag and display a progress bar or whatever when this flag is set.
a source to share