-
Silverlight and KeyDown
So this is a kinda complex problem. I have a silverlight application that I have developed that relies on some key presses to function, when running this application it grabs the KeyDown and KeyUp events off the host user control, everything works great. Well this application has to be hosted inside of another silverlight application, so you could think of my application as a dll (after all it really is) and it gets loaded into the main application through reflection. This hosting application has a few buttons and you click one to launch the desired application. To get the key presses we first tried to capture the KeyDown/KeyUp events on the main user control and they did not fire at all. We then added KeyDown/KeyUp events to the buttons and are able to pass our Key events into the application however we can not pass in spacebar or enter this way. Is there a way to do this that I haven't thought of yet. I also tried to change the buttons to rectangles, which worked for the button press events, however the rectangle fails to keep focus so it also has no key events fire.
-
Here is probably your answer
-
Thanks, that helps. Wonder why I didn't find that with google, is it just me or does google seem to suck lately?
[Edit]
Actually just got to the office and tried that and it has no effect. Still don't receive space/enter keys.
-
Ok, well was able to get something working but it required a few things. First we had to mark each button in the xaml with IsTabStop="false" then had to add an event in the application being loaded so that when its user control is loaded it first tells the silverlight plugin to focus and then the user control to focus, seems to be working good and passing all key presses on now.