Click here to Skip to main content
15,298,950 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a button1 which has an event handler, I want that button to be pressed virtually when i press the enter button. In other words, when I press enter I want the button1 event to be fired. How do I do this?

1 solution

Use the ControlName.InputBindings tag. Inside the subtag KeyBinding of the former give the attribute Key as "Enter" and specify the command with the Command attribute. You can read all about it here:[^].


Red&Black 28-May-11 11:08am
How do I specify the Click event of the button in the Command attribute?
Manfred Rudolf Bihy 28-May-11 11:39am
Study WPF basics! Googling CommandBinding will help you too. I found another page that should prove to be helpful:

Please learn how to google, please!

I'm serious about that.
Red&Black 28-May-11 11:49am
Thank you for your help.
I know I still need to study the basics of WPF and I will do this soon.
I'm sorry for posting such trivial questions... next time I'll try google first.
Manfred Rudolf Bihy 28-May-11 11:56am
"... next time I'll try google first ..."
That is a very good resolution to make :thumbsup:. If googling doesn't yield anything one can still post a question here on CP. :=)
Abhinav S 28-May-11 12:00pm
My 5. Very precise.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900