How to hide Windows Phone 8.1 soft keyboard effectively?

只愿长相守 提交于 2019-12-05 07:46:19

There is direct API support to hide and show the InputPane. You don't need to try to fake out the system.

The Windows.UI.ViewManagement.InputPane.TryShow and TryHide methods are available on Windows Phone 8.1.

The other option would be to move the focus to a more appropriate control when the user hits Enter.

This is the complete code to hide the keyboard when the user press the enter key

  private void TextBox_KeyUp(object sender, KeyRoutedEventArgs e)
    {
        if(e.Key==Windows.System.VirtualKey.Enter)
        {
            Windows.UI.ViewManagement.InputPane.GetForCurrentView().TryHide();
        }
    }

I just did something like that and it's working:

private async void makeRequest(string title, int page)
    {
        myTextBox.IsEnabled = false;
        myTextBox.IsTabStop = false;
        // here is my httprequest and changing itemssource of listview
        myTextBox.IsEnabled = true;
        myTextBox.IsTabStop = true;
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!