Textbox GotFocus WPF

private void tb_GotFocus(object sender, RoutedEventArgs e)
{
  TextBox tb = sender as TextBox;
  if (tb != null) {
    tb.SelectAll(); //select all text in TextBox
  }
}
DedSec