简体   繁体   English

WP7 - 在自动完成框中输入时隐藏键盘

[英]WP7 - hide keyboard on enter press in autocomplete box

I'm using an autocomplete box and I'd like to remove the focus from the autocomplete box when I press enter on the keyboard.我正在使用自动完成框,我想在按下键盘上的回车键时从自动完成框中移除焦点。

I tried using the OnKeyDown method but it won't detect the enter key being pressed (it detects all other keys).我尝试使用 OnKeyDown 方法,但它不会检测到按下的回车键(它检测到所有其他键)。

How can I detect the user pressing the enter key?如何检测用户按下回车键?

Thanks!谢谢!

Fortunately I solved it.幸好我解决了。 (I feel a bit stupid for asking the question now). (我觉得现在问这个问题有点傻)。

Turns out that although OnKeyDown works for most controls, in order to detect the enter key being pressed when using an autocomplete control, you need to use OnKeyUp.事实证明,尽管 OnKeyDown 适用于大多数控件,但为了在使用自动完成控件时检测按下的回车键,您需要使用 OnKeyUp。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM