void IExpressionEditorInstance.Focus()
        {
            try
            {
                // Dispatch to ensure that the visual is available before trying to move focus to the view
                Dispatcher.BeginInvoke(DispatcherPriority.Send, (DispatcherOperationCallback) delegate(object arg) {
                    if (!TextArea.IsKeyboardFocusWithin)
                    {
                        try
                        {
                            //TextArea.Focus();
                            //Focus();
                            //TextArea.MoveFocus(new System.Windows.Input.TraversalRequest(System.Windows.Input.FocusNavigationDirection.Next));
                            TextArea.Focus();
                        }
                        catch (Exception ex)
                        {
                            Log.Debug(ex.ToString());
                        }
                    }
                    return(null);
                }, null);

                // Raise an event
                GotAggregateFocus?.Invoke(this, EventArgs.Empty);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #2
0
        private void EditorInstance_IsKeyboardFocusWithinChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (IsKeyboardFocusWithin)
            {
                // Dispatch to ensure that the visual is available before trying to move focus to the view
                Dispatcher.BeginInvoke(DispatcherPriority.Send, (DispatcherOperationCallback) delegate(object arg) {
                    if (!TextArea.IsKeyboardFocusWithin)
                    {
                        try
                        {
                            //TextArea.Focus();
                            //Focus();
                            //(sender as ICSharpCode.AvalonEdit.TextEditor).TextArea.MoveFocus(new System.Windows.Input.TraversalRequest(System.Windows.Input.FocusNavigationDirection.Next));
                            TextArea.Focus();
                        }
                        catch (Exception ex)
                        {
                            Log.Debug(ex.ToString());
                        }
                    }
                    return(null);
                }, null);

                // Raise an event
                GotAggregateFocus?.Invoke(this, EventArgs.Empty);
            }
            else
            {
                // Raise an event
                LostAggregateFocus?.Invoke(this, EventArgs.Empty);
            }
        }
Exemple #3
0
        void UpdateAggregateFocus()
        {
            bool newValue = CalculateAggregateFocus();

            if (newValue != HasAggregateFocus)
            {
                hasAggregateFocus = newValue;
                if (newValue)
                {
                    GotAggregateFocus?.Invoke(this, EventArgs.Empty);
                }
                else
                {
                    LostAggregateFocus?.Invoke(this, EventArgs.Empty);
                }
            }
        }
        void UpdateAggregateFocus()
        {
            if (wpfHexView.IsClosed)
            {
                return;
            }
            bool newValue = CalculateAggregateFocus();

            if (newValue != HasAggregateFocus)
            {
                hasAggregateFocus = newValue;
                if (newValue)
                {
                    GotAggregateFocus?.Invoke(this, EventArgs.Empty);
                }
                else
                {
                    LostAggregateFocus?.Invoke(this, EventArgs.Empty);
                }
            }
        }
Exemple #5
0
        void UpdateKeyboardFocus()
        {
            if (IsClosed)
            {
                return;
            }
            bool newValue = this.IsKeyboardFocusWithin;

            if (hasKeyboardFocus != newValue)
            {
                hasKeyboardFocus = newValue;
                if (hasKeyboardFocus)
                {
                    GotAggregateFocus?.Invoke(this, EventArgs.Empty);
                }
                else
                {
                    LostAggregateFocus?.Invoke(this, EventArgs.Empty);
                }
            }
        }
 private void TextArea_GotFocus(object sender, RoutedEventArgs e)
 {
     GotAggregateFocus?.Invoke(sender, e);
 }