protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e) { if (this != Keyboard.FocusedElement) { base.OnGotKeyboardFocus(e); return; } // If there is no other child element getting focused as the focus // returned to the main window, then we need to explicitly set the // focus back onto the text canvas (or the start-up page, whichever // is currently on top). if (null != textEditorControl) { textEditorControl.SetFocusOnForegroundContent(); } }