title: XAML - How to have global inputBindings?
body: <p>I have a WPF application with several windows. I would like to define GLOBAL inputBindings.</p>
  
  <p>To define LOCAL inputbindings, i just declare the input in Window.InputBindings or UserControl.InputBindings. </p>
  
  <p>To define GLOBALs, I wish i could do the same with the Application class... </p>
  
  <pre><code>&lt;Application
  ....&gt;
  &lt;Application.InputBindings&gt;
  ...
  &lt;/Application.InputBindings&gt;
  </code></pre>
  
  <p>If i have the same binding in 2 different windows, i have to code it twice. This doesn't meet D.R.Y.'s philosophy and i guess there is a better way... </p>
  
  <p>EDIT : in his answer <a href="https://stackoverflow.com/users/5380/kent-boogaart">Kent Boogaart</a> advices me to use Style. Unfortunately, i can't figure out how to define it. This is the code :</p>
  
  <pre><code> &lt;Application.Resources&gt;
      &lt;Style TargetType="Window"&gt;
          &lt;Setter Property="InputBindings"&gt;
              &lt;Setter.Value&gt;
                  &lt;Window.InputBindings&gt;
                      &lt;KeyBinding KeyGesture="Ctrl+M" Command="local:App.MsgCommand /&gt;
                  &lt;/Window.InputBindings&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  &lt;/Application.Resources&gt; 
  </code></pre>
  
  <p>It raises an error : error MC3080: The Property Setter 'InputBindings' cannot be set because it does not have an accessible set accessor.</p>
  
  <p>Is my style wrong?
  Is there another solution?</p>
  
  <p>Any ideas? thanks!</p>