This question is basically the same as
Silverlight keydown event for games
but there was never really a clear answer. How can I get smooth keypresses for a game.
Can I check what keys are currently being held down inside a timer? (My best idea)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The answer given was correct, you can’t detect the currently pressed keys. However you can handle key down and key up on the form at the layoutroot element. You can then build you’re own class which tracks the currently pressed keys. Simply add keys to a list whenever you get a key down event and remove them from the list when you get a key up event. You can then use PressedKeys.Contains(MyKey) to determine if a key is pressed.