I have an application that works fine as a simple WPF application that has an event handler in GotFocus at the main window level, for example:
private void MainWindowGotFocus(object sender, RoutedEventArgs e) { var element = FocusManager.GetFocusedElement(this) as FrameworkElement; if (element != null) {
However, this behaves strangely when installed as an XBAP application (almost exactly the same code), the main visual element is the page, not the window, but the event is still accessible and triggered).
In this case (the XBAP / wpf browser application) is always null.
Any ideas ?: (
source share