处理输入按键 [英] Handle enter key press
问题描述
我的应用包含一个页面,多个文本框和一个应用栏。我可以在每个文本框(keydown事件)中处理输入,但应该有更好的方法。我怎样才能让用户在使用应用程序时按下enter键(无论焦点如何),
我做点什么?
My app contains a single page, several text boxes and an app bar. I can handle enter press in every textbox (keydown event) but there should be a better way. How can I make it so that if user presses enter while using the app (regardless of focus), I do something?
Thx!
Berk
推荐答案
您好,
请阅读粘性帖子,尤其是 指南发布:主题行
代码 &absp; Windows 10的已知问题SDK和工具 ,
并且不要忘记在您的问题中添加标记。
Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools , and don't forget add tag to your question.
如果您的应用具有焦点,此代码将有效
This code will work if your app has focus
CoreWindow.GetForCurrentThread().KeyDown += KeyDwn;
private void KeyDwn(CoreWindow sender,KeyEventArgs args)
{
private void KeyDwn(CoreWindow sender, KeyEventArgs args) {
}
这篇关于处理输入按键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!