WPF: How do I disable the SystemMenu shortcut 'Alt+Space'?
Asked Answered
F

1

6

I have a borderless window and created the chrome but I need to disable the 'Alt+Space' shortcut. Any thoughts?

Frown answered 16/2, 2010 at 22:54 Comment(2)
Keep in mind that it's very bad practise to disable system shortcuts. I would personally uninstall an application that tried to mess with Alt-Space. Just an FYI.Mikemikel
Thanks Richard but I was handling system shortcut to implement it myself. Same keys, added functionality.Frown
U
10

I'm not very good with WPF, but after some messing around, this seems to be on the right track. Just throw it in your Window code-behind:

    protected override void OnKeyDown(KeyEventArgs e)
    {
        if (Keyboard.Modifiers == ModifierKeys.Alt && e.SystemKey == Key.Space)
        {
            e.Handled = true;
        }
        else
        {
            base.OnKeyDown(e);
        }
    }
Usually answered 17/2, 2010 at 0:2 Comment(1)
Thanks Cory. I just spent 6 hours sizing and moving a borderless form with KeyDown (arrows & Ctrl, etc). You'd think this would occur to me?!? :-) Thanks again.Frown

© 2022 - 2024 — McMap. All rights reserved.