Hide On Screen Keyboard without using .Focus() on another element

怎甘沉沦 提交于 2019-12-23 04:33:47

问题


I am developing an application for WindowsPhone 8 platform which mimics the functionality of on-screen key pad.

I want to use TextBox to display characters on the screen and I want to input text using another keypad which is implemented using buttons and events.

There is a problem because when I tap on the TextBox the on-screen key pad always appears on top of everything. The only way I know to disable the on-screen key pad is using .Focus() method in events. This is not suitable for me because if the TextBox is not focused I cannot dynamically select text from it and it is not automatically scroll down when the TextBox is filling up. Is there any other way to disable the on-screen key pad while keeping the focus on the TextBox or is there any way to display something on top of the on-screen keypad. I need to get some solution because this is related to my final year project.


回答1:


It seems that SomeElement.Focus() is the only way you can use to hide the On Screen Keyboard, where SomeElement is a Focusable and a non Text Control. At this stage of the WindowsPhone SDK you can't do something else at my knowledge and according to many confirming threads and articles here on SO or elsewhere on the internet.




回答2:


From what I understand about what you're trying to do, you could simply set the IsReadOnly property to True.

<TextBox IsReadOnly="True" ... />



回答3:


You can hide the keypad using the line

    this.focus();


来源:https://stackoverflow.com/questions/21954103/hide-on-screen-keyboard-without-using-focus-on-another-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!