I want to hide the Soft Keyboard when enter/return key is pressed from editing a TextBox. This is what I have so far in c#:
private void SearchBox_KeyUp(object sender, KeyRoutedEventArgs e)
{
TextBox textBox = sender as TextBox;
if(e.Key == VirtualKey.Enter)
{
this.Focus(FocusState.Programmatic); // sending focus to Page to hide keyboard
}
}
Try shortly disabling and then enabling the TextBox.
if(e.Key == VirtualKey.Enter)
{
textBox.IsEnabled = false;
textBox.IsEnabled = true;
}