Exemplo n.º 1
0
        private void Adornment_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            if (e.OldFocus == this)
            {
                return;
            }

            IdentifierTextBox.Focus();
            e.Handled = true;
        }
Exemplo n.º 2
0
        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();
        }