C#C
C#2y ago
Denis

✅ 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?
Was this page helpful?