title: WPF: Calling a keyboard shortcut for a routed command if you're in a TextBox
body: <p>I have a button that has the following commands:</p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;RoutedUICommand x:Key="CommandPretraga"/&gt;
  &lt;/Window.Resources&gt;
  
  &lt;Window.CommandBindings&gt;
      &lt;CommandBinding Command="{StaticResource CommandPretraga}" Executed="chkPretraga_Click" /&gt;
  &lt;/Window.CommandBindings&gt;
  
  &lt;Window.InputBindings&gt;
      &lt;KeyBinding Key="ENTER" Command="{StaticResource CommandPretraga}" /&gt;
  &lt;/Window.InputBindings&gt;
  </code></pre>
  
  <p>The shortcut works if called from most of the window, but if I'm currently in one of my <code>TextBox</code> elements, the shortcut doesn't work. I'm guessing that this is because the <code>TextBox</code> is registering and processing the ENTER key event, and I tried catching that and calling the same function the shortcut is supposed to call, but that didn't work.</p>
  
  <p>How can I solve this?</p>