private void Adornment_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { if (e.OldFocus == this) { return; } IdentifierTextBox.Focus(); e.Handled = true; }
public RenameFlyout(RenameFlyoutViewModel viewModel, ITextView textView) { DataContext = _viewModel = viewModel; _textView = textView; _textView.LayoutChanged += TextView_LayoutChanged; _textView.ViewportHeightChanged += TextView_ViewPortChanged; _textView.ViewportWidthChanged += TextView_ViewPortChanged; _textView.LostAggregateFocus += TextView_LostFocus; _textView.Caret.PositionChanged += TextView_CursorChanged; // On load focus the first tab target Loaded += (s, e) => { IdentifierTextBox.Focus(); IdentifierTextBox.Select(_viewModel.StartingSelection.Start, _viewModel.StartingSelection.Length); }; InitializeComponent(); PositionAdornment(); }
private void IdentifierTextBox_GotFocus(object sender, RoutedEventArgs e) { IdentifierTextBox.SelectAll(); }