Microsoft.Windows.Controls.Ribbon.RibbonGalleryItem.OnKeyDown C# (CSharp) Method

OnKeyDown() protected method

This is the method that responds to the KeyDown event.
protected OnKeyDown ( System.Windows.Input.KeyEventArgs e ) : void
e System.Windows.Input.KeyEventArgs Event arguments
return void
        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (e.Key == Key.Space)
            {
                // Alt+Space should bring up system menu, we shouldn't handle it.
                if ((Keyboard.Modifiers & ModifierKeys.Alt) != ModifierKeys.Alt)
                {
                    if (e.OriginalSource == this)
                    {
                        IsPressed = true;
                        e.Handled = true;
                    }
                }
            }
            else if (e.Key == Key.Enter)
            {
                if (e.OriginalSource == this)
                {
                    if (IsHighlighted)
                    {
                        SetSelectedOnInput();
                        e.Handled = true;
                    }
                }
            }

            base.OnKeyDown(e);
        }