我们可以使用Custom AutomationPeer
显示/隐藏Windows应用商店应用的触摸键盘,但是对于Windows Phone 8.1 OnCreateAutomationPeer()
未在GotFocus()
上调用。
我怎样才能这样做?任何帮助将不胜感激。
答案 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();
}