private static void TextBox_GotFocus(object sender, RoutedEventArgs e) { TextBox textBox = sender as TextBox; if (textBox != null && textBox.TextWrapping == TextWrapping.NoWrap && !TextBoxHelper.GetPreventSelectAllOnFocus(textBox)) { textBox.SelectAll(); } }
private static void TextBox_PreviewMouseDown(object sender, MouseButtonEventArgs e) { TextBox textBox = sender as TextBox; if (textBox != null && textBox.Focusable && !textBox.IsFocused && textBox.TextWrapping == TextWrapping.NoWrap && !TextBoxHelper.GetPreventSelectAllOnFocus(textBox)) { textBox.Focus(); e.Handled = true; } }