I have a Silverlight game controlled by the keyboard, and I want it to go into pause when it loses the keyboard focus (e.g. the user clicks on another part of the hosting webpage, or moves to another browser tab).
I used to do this in Silverlight 1.1 by subscribing to the LostFocus event on my RootVisual UserControl, but in the last two versions of Silverlight, I have found this event seems to fire unexpectedly shortly after clicking a button in my application (in Silverlight 2 it fired once, in Silverlight 3 twice!).
Is there a way in javascript on the hosting page, or within Silverlight to detect loss of focus more reliably?