本文主要是介绍[垃圾microsoft, 要啥缺啥] c# metro app keydown issue,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
下面这段代码是用来检测在textbox里 keydown event:
private void txtTest_KeyDown(object sender, KeyRoutedEventArgs e){lblInfo.Text = lblInfo.Text + "," + (int)e.Key;}
和keyboard reader完全无关,因为你就算用virtual keyboard来在textbox里输入信息也是同样效果。
如果不是textbox,而是Controls.Page 来trigger keydown event, 因为对于中文输入法,textbox虽然捕捉不到keydown event,但可以通过获取textbox.text来获得card info。if use controls.page to trigger keydown event, then there must be at least one component in the page. passwordBox or button component is recommended (it looks that no chinese input issue for passwordbox and button), DON'T use textbox because of chinese input issue.
Note: if no component in the page is focused (for example, you tap any other area in the page), then it will not trigger any keydown event!!! Hence when the component lose focus, focus again.
Therefore, my solution of visitor log project smart reader view as below.
1. in the page, there is only one "cancel" button except 2 labels. When the button is clicked, back to parent page. If this button lose focus, focus again.
2. It seems that you needn't set this button focused explicitly, if it is only one component in page, it will be focused automatically when page is loaded.
这篇关于[垃圾microsoft, 要啥缺啥] c# metro app keydown issue的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!