按下Enter键时发生火灾事件? [英] fire event when enter is pressed?
本文介绍了按下Enter键时发生火灾事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我有一个带有事件处理程序的button1,我希望在我按Enter按钮时实际上要按下该按钮.换句话说,当我按Enter时,我希望触发button1事件.我该怎么做?
Hello,
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?
推荐答案
使用ControlName.InputBindings
标记.在前者的子标签KeyBinding
中,将属性Key
设置为"Enter",并使用Command
属性指定命令.您可以在这里阅读所有内容: http://www.paulspatterson .com/technology/dot-net-development/wpf-enter-key-input-binding/ [
Use theControlName.InputBindings
tag. Inside the subtagKeyBinding
of the former give the attributeKey
as "Enter" and specify the command with theCommand
attribute. You can read all about it here: http://www.paulspatterson.com/technology/dot-net-development/wpf-enter-key-input-binding/[^].
Cheers!
-MRB
这篇关于按下Enter键时发生火灾事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文