Is it possible to catch F5 in a Silverlight application?

I have a function request to catch the F5 key and update content in a Silverlight application, instead of the browser updating the entire application. In a simple application, I tried to hook up a KeyDown event, and it never gets there with F5.

Is this something Silverlight can do?

+6
source share
3 answers

First, the browser receives all the keys pressed and determines whether it will transmit them to the hosted content (Silverlight) or not. AFAIK there is no way to stop the update when you press F5, since it will always be processed by the browser.

You might be able to use javascript to detect keystrokes and pass it to SL, but I'm sure this will not stop the browser from updating.

+3
source

I found this post that shows how to do this in javascript. I tested it and it works (IE9) ... if you are not focused on the Silverlight application :-). This SO post is similar, but has no solution yet.

After that, I agree with @Phil that stopping the update is probably not possible, at least for IE.

+1
source

If the client is happy to provide your code to this browser, you may be able to convince them to install the application outside the browser, where you can significantly increase navigation control

0
source

Source: https://habr.com/ru/post/897422/


All Articles