Thanks to OxA3's question and his own answer, I found a workaround. Using the Preview_KeyDown event on the window has the desired effect. The workaround just pushes all of the KeyGestures to the window.
This was answered back in 2009. I researched for a long time and did not find it until today. I wanted to post the answer here so that anyone that was looking for something a little more specific in regard to KeyGestures would find it.
I preempted the foreach loops by adding a condition on the Keyboard.Modifiers state. Below are my changes:
void MainWindow_PreviewKeyDown(object sender, KeyEventArgs e)
{
// don't bother with it if we are not modified
if (Keyboard.Modifiers == ModifierKeys.None) return;
foreach (InputBinding inputBinding in this.InputBindings)
{
KeyGesture keyGesture = inputBinding.Gesture as KeyGesture;
if (keyGesture != null && keyGesture.Key == e.Key && keyGesture.Modifiers == Keyboard.Modifiers)
{
if (inputBinding.Command != null)
{
inputBinding.Command.Execute(0);
e.Handled = true;
}
}
}
foreach (CommandBinding cb in this.CommandBindings)
{
RoutedCommand command = cb.Command as RoutedCommand;
if (command != null)
{
foreach (InputGesture inputGesture in command.InputGestures)
{
KeyGesture keyGesture = inputGesture as KeyGesture;
if (keyGesture != null && keyGesture.Key == e.Key && keyGesture.Modifiers == Keyboard.Modifiers)
{
command.Execute(0, this);
e.Handled = true;
}
}
}
}
}