Skip to content

Instantly share code, notes, and snippets.

@glebd
Created April 20, 2010 11:56
Show Gist options
  • Save glebd/372343 to your computer and use it in GitHub Desktop.
Save glebd/372343 to your computer and use it in GitHub Desktop.
// in startup code
EventManager.RegisterClassHandler(
typeof (TextBox),
TextBox.GotFocusEvent,
new RoutedEventHandler(TextBox_GotFocus));
EventManager.RegisterClassHandler(
typeof(TextBox),
TextBox.GotKeyboardFocusEvent,
new RoutedEventHandler(TextBox_GotFocus));
private static void TextBox_GotFocus(object sender, RoutedEventArgs e)
{
var textBox = sender as TextBox;
if (textBox == null) return;
textBox.SelectAll();
}
@glebd
Copy link
Author

glebd commented Apr 20, 2010

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment