示例#1
0
        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();
            }
        }
示例#2
0
        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;
            }
        }