views:

7

answers:

0

Ok, I'm not sure I understand how this should work, but in my app I have bound a key gesture (Ctrl+K) to a RoutedCommand. No matter where I focus in my app, the key combination works, except if I use it inside of a WindowsFormsHost containing a web browser control. I tried capturing the PreviewKeyDown event for the web browser control and setting the IsInputKey to false. This should, in theory, cause the Host to consider the key gesture untreated and send it upwards, but that doesn't happen.

UPDATE:

If I override the control's bool IsInputKey (Keys keyData) and return false, it works and the command gets executed as it should.

Maybe there is something wrong in the way I handled PreviewKeyDown?

private void browser_PreviewKeyDown (object sender, PreviewKeyDownEventArgs e)
{
    e.IsInputKey = false;
}

I expected this to allow me to capture any key combination from my main window. I'd rather fix this with event handling than extending a control...