I am creating a Windows 8.1 app and after the user presses a button, a popup opens over most of the screen. There are several textboxes inside the popover.
I found this sample code from microsoft about how to detect the appearance of the on-screen keyboard.
I have also found the following SO posts and sites basically informing that there is no way to force the keyboard to close, and the correct thing to do is in fact programmatically focus a hidden element on the page or disable and then re-enable the textbox:
- Forcing Windows 8 soft keyboard to hide
- Windows 8 soft keyboard not hidden
- Show/Hide Keyboard Automatically Widnows 8
- How to Dismiss Touch Keyboard
So I followed the advice and created an invisible button. When the user taps the close button, it is supposed to give focus to that button and dismiss the keyboard. What happens is the textbox does lose focus, but the keyboard does not go away. If I cause the close button to give focus to the hidden button and close the popup (which is the desired effect), the keyboard does not go away until the view (that was previously under the popup) is tapped.
How can I make closing the popup cause the keyboard to dismiss?
EDIT: It appears that there might be a way to programmatically dismiss the keyboard because triggering the App Bar to open while the keyboardi s open automatically dismisses the keyboard.