private static void OnLostFocus(object sender, KeyboardFocusChangedEventArgs e)
{
ActiveXHost axhost = sender as ActiveXHost;
if (axhost != null)
{
// If the focus goes from our control window to one of the child windows,
// we should not deactivate.
//
Invariant.Assert(axhost.ActiveXState >= ActiveXHelper.ActiveXState.UIActive, "Should at least be UIActive when losing focus");
bool uiDeactivate = !axhost.IsKeyboardFocusWithin;
if (uiDeactivate)
{
axhost.TransitionDownTo(ActiveXHelper.ActiveXState.InPlaceActive);
}
}
}