© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
4 replies
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?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ WPF, ICommand, list remove item button need help.
C#CC# / help
3y ago
✅ WPF Help with ICommand
C#CC# / help
2y ago
❔ Stop a loop when a key is pressed
C#CC# / help
4y ago