Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to catch F5 in a Silverlight application

I have a feature request to catch the F5 key and refresh content within a Silverlight application instead of having the browser refresh the entire application. In a simple app, I tried hooking the KeyDown event and it never gets there with F5.

Is this something that is possible to do in Silverlight?

like image 984
Brian Kohrs Avatar asked Sep 15 '11 19:09

Brian Kohrs


1 Answers

The browser gets all key pressed first and determines whether it will pass them to the hosted content (Silverlight) or not. AFAIK there is no way of stopping a refresh when F5 is pressed, since it will always be handled by the browser.

You may be able to use javascript to detect the keypress and pass it to SL, but I'm pretty sure that won't stop the browser from refreshing.

like image 170
Phil Sandler Avatar answered Nov 10 '22 05:11

Phil Sandler