protected override void FocusContent() { if (!(IsActiveContent && !IsKeyboardFocusWithin)) { return; } IInputElement activeChild = CustomFocusManager.GetFocusedChild(this); AvalonWorkbenchWindow.SetFocus(this, () => activeChild ?? (padInstance != null ? padInstance.InitiallyFocusedControl as IInputElement : null)); }
protected override void FocusContent() { WpfWorkbench.FocusDebug("{0}.FocusContent() IsActiveContent={1} IsKeyboardFocusWithin={2} Keyboard.FocusedElement={3}", Title, IsActiveContent, IsKeyboardFocusWithin, Keyboard.FocusedElement); if (!(IsActiveContent && !IsKeyboardFocusWithin)) { return; } IInputElement activeChild = CustomFocusManager.GetFocusedChild(this); WpfWorkbench.FocusDebug("{0}.FocusContent() - Will move focus (activeChild={1})", this.Title, activeChild); // use lambda for fetching the active child - this is necessary because the ActiveViewContent might change until the background // action is called AvalonWorkbenchWindow.SetFocus(this, () => activeChild ?? (ActiveViewContent != null ? ActiveViewContent.InitiallyFocusedControl as IInputElement : null)); }
/// <summary> /// Gets the target for re-routing commands to this window. /// </summary> internal IInputElement GetCommandTarget() { return(CustomFocusManager.GetFocusedChild(this) ?? GetActiveWinFormsHost()); }