/// <summary> /// Event Keyboard is focused on text box /// Used by blur to remove blur text /// Used by Focus to select all text /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void AdvancedTextBox_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { Console.WriteLine("AdvancedTextBox_GotKeyboardFocus"); AdvancedTextBox ftb = sender as AdvancedTextBox; ftb.IsBlur = false; if (ftb.IsAdvancedFocus) { ftb.Focus(); string t = ftb.Text; ftb.Text = t; ftb.SelectAll(); ftb.Focus(); e.Handled = true; } }
/// <summary> /// Event when the mouse has clicked /// Used by the blur text remove any blur effects /// Used by the advanced focus to select all text /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void AdvancedTextBox_PreviewMouseDown(object sender, MouseButtonEventArgs e) { Console.WriteLine("AdvancedTextBox_PreviewMouseDown"); AdvancedTextBox ftb = sender as AdvancedTextBox; ftb.IsBlur = false; if (ftb.IsAdvancedFocus) { ftb.Focus(); string t = ftb.Text; ftb.Text = t; ftb.SelectAll(); ftb.Focus(); e.Handled = true; } }