title: Application-level shortcuts
body: <p>I am developing a WPF application, it is kept minimized in the system tray and I want the window to open when a shortcut is pressed (example: Ctrl + Space).</p>
  <p>I have tried using CommandBindings but it only works when the window has the focus, I want the window to stay hidden and show only when the shortcut is pressed.</p>
  <p>Xaml Code:</p>
  <pre><code>&lt;CommandBinding Command=&quot;{x:Static local:SearchWindow.ShowWindowCommand}&quot; Executed=&quot;ShowWindowCommandExecuted&quot;/&gt;
  </code></pre>
  <p>C# Code:</p>
  <pre><code>public SearchWindow()
  {
          ShowWindowCommand.InputGestures.Add(new KeyGesture(Key.Space, ModifierKeys.Control));
          InitializeComponent();
  }
  
  private void ShowWindowCommandExecuted(object sender, ExecutedRoutedEventArgs e)
  {
      Show();
  }
  </code></pre>