在Windows Phone 8.1的自定义控件中显示触摸键盘

时间:2014-08-19 07:06:34

标签: windows-phone-8 windows-phone-8.1

我们可以使用Custom AutomationPeer显示/隐藏Windows应用商店应用的触摸键盘,但是对于Windows Phone 8.1 OnCreateAutomationPeer()未在GotFocus()上调用。

我怎样才能这样做?任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

您可以使用FocusManager课程获得焦点。

一般情况下,它会像这样移除焦点,从而隐藏键盘:

var focusedObject = FocusManager.GetFocusedElement();
if (focusedObject != null)
{
    var root = (Frame)Application.Current.RootVisual;
    // Set Focus to Page to close the keyboard
    if (root != null) root.Focus();
}
相关问题