I want to hide the soft keyboard when the Enter key is tapped, but no solutions works for me properly. (Windows Phone 8.1 Universal App)
This one just doesn't work:
if (e.Key == VirtualKey.Enter)
{
textBox.IsEnabled = false;
textBox.IsEnabled = true;
}
A method like this:
private void LoseFocus(object sender)
{
var control = sender as Control;
var isTabStop = control.IsTabStop;
control.IsEnabled = false;
control.IsTabStop = false;
control.IsEnabled = true;
control.IsTabStop = isTabStop;
}
works only partially. It's hiding keyboard only when I'm using textbox for the first time. On the second time keyboard is reappearing.
IsEnabled
off and back on in the same method, the form won't register your changes until after the method completes. You can toggle the value all you want within the method, but only the result after the function is done is what matters. – gunr2171