title: Keybinding in WPF
body: <p>I'm new to WPF and in an application i'm building I'd like to show the main menu when the alt key is pressed just like windows explorer in vista and windows 7. I've tried using a keybinding with just the modifier set but that doesn't seem to work. </p>
  
  <p>Heres by code so far:</p>
  
  <p><pre><code>&lt;Window.CommandBindings>
      &lt;CommandBinding Command="{x:Static local:MainWindow.ShowMenuCommand}"
                          CanExecute="ShowMenuCommand_CanExecute"
                          Executed="ShowMenuCommand_Executed"/>
  &lt;/Window.CommandBindings>
  &lt;Window.InputBindings>
      &lt;KeyBinding Key="Alt" Command="{x:Static local:MainWindow.ShowMenuCommand}" />
  &lt;/Window.InputBindings></pre></code></p>
  
  <p>I'd also like the menu to disappear when the focus is lost.</p>
  
  <p>Any ideas?</p>