Microsoft.Windows.Controls.Ribbon.RibbonComboBox.OnGalleryGotKeyboardFocus C# (CSharp) Method

OnGalleryGotKeyboardFocus() private method

private OnGalleryGotKeyboardFocus ( object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e ) : void
sender object
e System.Windows.Input.KeyboardFocusChangedEventArgs
return void
        void OnGalleryGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            // When on of the GalleryItems within the _firstGallery acquires Keyboard
            // focus reinstate focus to the parent based on the IsEditable mode

            RibbonGalleryItem focusedGalleryItem = Keyboard.FocusedElement as RibbonGalleryItem;
            if (focusedGalleryItem != null)
            {
                if (IsEditable && EditableTextBoxSite != null)
                {
                    EditableTextBoxSite.Focus();
                }
                else if (!IsEditable && PartToggleButton != null)
                {
                    PartToggleButton.Focus();
                }
                else
                {
                    Focus();
                }
            }
        }