Example #1
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);
            }
        }
Example #2
0
        private void EditorLostFocus(object sender, EventArgs e)
        {
            var popupItem = this.GetFocusedElement() as ListBoxItem;

            if (popupItem == null)
            {
                if ((isPopup != null) && (isPopup.IsOpen))
                {
                    this.UnInitilaizePopup();
                }
                LostAggregateFocus?.Invoke(sender, e);
            }
        }
Example #3
0
        /// <summary>Occurs when the editor text-box looses focus.</summary>
        /// <param name="sender">The object from which the event initiated.</param>
        /// <param name="e">The object that contains the event data.</param>
        private void Editor_LostFocus(object sender, EventArgs e)
        {
            ListBoxItem item = Keyboard.FocusedElement as ListBoxItem;

            if (item == null)
            {
                if (completionPanel != null && completionPanel.IsOpen)
                {
                    HidePopup();
                }
                LostAggregateFocus?.Invoke(sender, EventArgs.Empty);
            }
        }
Example #4
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);
                }
            }
        }
Example #6
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 Editor_LostFocus(object sender, RoutedEventArgs e)
 {
     LostAggregateFocus?.Invoke(sender, EventArgs.Empty);
 }