✅ Execute ICommand while button is pressed
In my WPF view I have a 9x9 grid of buttons representing movement controls: up, down, left, right, home.
I wish to press and hold such a button to execute a Viewmodel command until the button is released.
These buttons would serve to move the viewport of a canvas.
Afaik, this isn't possible directly, as a button command is invoked on click. So this will probably require some markup extension to attach to the button events directly; however, my attempts were not fruitful.
How would you implement such a feature?
3 Replies
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
The functionality as you describe doesn't seem like it would belong to a viewmodel tbh, so I agree with @Duke here, this is just going to be window events.
why would your viewmodel care about the viewport?
Hmm ok, I'll think about it a bit harder. Thanks!