Last active
January 11, 2016 17:45
-
-
Save fcaldarelli/f0ee3b64b46ca689b397 to your computer and use it in GitHub Desktop.
Close keyboard when clicking on return key of textbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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