My program is quite large, and uses WPF, and I want to have a global shortcut key that uses \'R\', with no modifiers.
There are many controls such as TextBox, ListBox, Combo
Simply check what the OriginalSource is in your KeyDown event handler on the Window:
private void Window_KeyDown(object sender, KeyEventArgs e) {
if(e.OriginalSource is TextBox || e.OriginalSource is DateTimePicker) //etc
{
e.Handled = true;
return;
}
}
Or if you are using InputBindings, experiment with setting e.Handled = true in either the KeyDown or the PreviewKeyDown event on your Window, rather than the individual controls. In anyway, I think OriginalSource is the key to your answer. (I swear that was not a pun).
There is an event when you handle KeyDown event and it should pass you a KeyEventArgs. From there you can set the Handled to true so that it won't bubble up.
Sample
private void TextBoxEx_KeyAction(object sender, KeyEventArgs e)
{
e.Handled = true;
}