protected override void FocusContent() { if (!(IsActiveContent && !IsKeyboardFocusWithin)) { return; } IInputElement activeChild = CustomFocusManager.GetFocusedChild(this); AvalonWorkbenchWindow.SetFocus(this, () => activeChild ?? (padInstance != null ? padInstance.InitiallyFocusedControl as IInputElement : null)); }
public AvalonWorkbenchWindow(AvalonDockLayout dockLayout) { if (dockLayout == null) { throw new ArgumentNullException("dockLayout"); } CustomFocusManager.SetRememberFocusedChild(this, true); this.IsFloatingAllowed = true; this.dockLayout = dockLayout; viewContents = new ViewContentCollection(this); ResourceService.LanguageChanged += OnTabPageTextChanged; }
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)); }
public AvalonPadContent(AvalonDockLayout layout, PadDescriptor descriptor) { this.descriptor = descriptor; this.layout = layout; CustomFocusManager.SetRememberFocusedChild(this, true); this.Name = descriptor.Class.Replace('.', '_'); this.SetValueToExtension(TitleProperty, new StringParseExtension(descriptor.Title)); placeholder = new TextBlock { Text = this.Title }; this.Content = placeholder; this.Icon = PresentationResourceService.GetBitmapSource(descriptor.Icon); placeholder.IsVisibleChanged += AvalonPadContent_IsVisibleChanged; }
/// <summary> /// Gets the target for re-routing commands to this window. /// </summary> internal IInputElement GetCommandTarget() { return(CustomFocusManager.GetFocusedChild(this) ?? GetActiveWinFormsHost()); }