现在我正在开发Windows 8 Metro应用程序。为此,我有一个带有文本框和确定按钮的弹出窗口。当在虚拟键盘上单击"Enter“时,我需要隐藏虚拟键盘。如果我点击弹出键盘上的“确定”按钮,键盘会自动隐藏。
我得到了this Link作为很好的参考(使用HiddenField)。有没有办法不使用"HiddenField“来完成这项工作。提前谢谢..
发布于 2012-10-29 23:36:52
我们终于找到了解决这个问题的办法..我只是将焦点从文本框切换到弹出窗口中的按钮。下面是示例代码。
public void FocusTextbox(object sender, EventArgs e)
{
// set focus to textbox on popup open
Textbox.Focus(Windows.UI.Xaml.FocusState.Programmatic);
}
public void Textbox_KeyDown(object sender, KeyRoutedEventArgs e)
{
// conforming the "Enter" button click
if (e.Key == Windows.System.VirtualKey.Enter)
{
// change the focus to OK button
this.OkButton.Focus(Windows.UI.Xaml.FocusState.Pointer);
}
}在关闭弹出窗口之前更改焦点...现在它工作得很好..
将焦点更改为Label或Textblock并不会隐藏虚拟键盘...
发布于 2012-10-29 18:44:53
我也在找这个,但我先找到了this approach
https://stackoverflow.com/questions/13118147
复制相似问题