We're building an app that makes use of hotkeys, it's a web UI to an existing windows app. Normally you can check that
Keyboard.Modifiers == ModifierKeys.Alt
However when you're using combos with Alt, the browser captures the Alt keystroke to see if it can handle it.
The only way around this I've seen so far is to manually wire up to the keydown events in the DOM like this:
System.Windows.Browser.HtmlPage.Document.Body.AttachEvent("onkeydown", new EventHandler<System.Windows.Browser.HtmlEventArgs>(OnBodyKeyDown));
Then have your code check signal with a flag whether the ALT key is pressed or not. This is described here.
KeyEventArgs is sealed so you can't just raise it yourself and you can't set the Modifiers directly.
Clearly this isn't an ideal situation, does anyone have any insight on how this might be better accomplished?
[We're working with Silverlight 3.0.]