Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fcaldarelli/f0ee3b64b46ca689b397 to your computer and use it in GitHub Desktop.
Save fcaldarelli/f0ee3b64b46ca689b397 to your computer and use it in GitHub Desktop.
Close keyboard when clicking on return key of textbox
// In Page class
public sealed partial class CustomPage : Page
{
public CustomPage()
{
this.InitializeComponent();
//...
// This will give input focus capability to page
this.IsTabStop = true;
}
private void textbox1_KeyUp(object sender, KeyRoutedEventArgs e)
{
if (e.Key == VirtualKey.Enter)
{
// This will move focus from textbox to the page
this.Focus(FocusState.Programmatic);
}
}
...
...
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment