예제 #1
0
        private void Show()
        {
            this.timer.Stop();

            // Check whether the window is
            // - still present (prevents exceptions when window is closed by system commands)
            // - still active (prevents keytips showing during Alt-Tab'ing)
            if (this.window == null ||
                this.window.IsActive == false)
            {
                this.RestoreFocus();
                return;
            }

            // Special behavior for backstage, application menu and start screen.
            // If one of those is open we have to forward key tips directly to them.
            var keyTipsTarget = this.GetStartScreen()
                                ?? this.GetBackstage()
                                ?? this.GetApplicationMenu()
                                ?? this.ribbon;

            if (keyTipsTarget == null)
            {
                return;
            }

            this.ClosePopups();

            this.backUpFocusedControl = null;

            // If focus is inside the Ribbon already we don't want to jump around after finishing with KeyTips
            if (UIHelper.GetParent <Ribbon>(Keyboard.FocusedElement as DependencyObject) == null)
            {
                this.backUpFocusedControl = FocusWrapper.GetWrapperForCurrentFocus();
            }

            if (keyTipsTarget is Ribbon targetRibbon &&
                targetRibbon.IsMinimized == false &&
                targetRibbon.SelectedTabIndex >= 0 &&
                targetRibbon.TabControl != null)
            {
                // Focus ribbon
                (this.ribbon.TabControl.ItemContainerGenerator.ContainerFromIndex(this.ribbon.TabControl.SelectedIndex) as UIElement)?.Focus();
            }

            this.ClearUserInput();

            if (this.activeAdornerChain != null)
            {
                this.activeAdornerChain.Terminated -= this.OnAdornerChainTerminated;
            }

            this.activeAdornerChain             = new KeyTipAdorner(keyTipsTarget, keyTipsTarget, null);
            this.activeAdornerChain.Terminated += this.OnAdornerChainTerminated;
            this.activeAdornerChain.Attach();
        }
예제 #2
0
        private void Show()
        {
            this.timer.Stop();

            // Check whether the window is
            // - still present (prevents exceptions when window is closed by system commands)
            // - still active (prevents keytips showing during Alt-Tab'ing)
            if (this.window == null ||
                this.window.IsActive == false)
            {
                this.RestoreFocus();
                return;
            }

            this.ClosePopups();

            // If focus is inside the Ribbon already we don't want to jump around after finishing with KeyTips
            if (UIHelper.GetParent <Ribbon>(Keyboard.FocusedElement as DependencyObject) == null)
            {
                this.backUpFocusedControl = FocusWrapper.GetWrapperForCurrentFocus();
            }

            // Focus ribbon
            this.ribbon.SelectedTabItem?.Focus();

            this.ClearUserInput();

            this.activeAdornerChain             = new KeyTipAdorner(this.ribbon, this.ribbon, null);
            this.activeAdornerChain.Terminated += this.OnAdornerChainTerminated;

            // Special behavior for backstage
            var specialControl = this.GetBackstage()
                                 ?? this.GetApplicationMenu()
                                 ?? this.GetStartScreen();

            if (specialControl != null)
            {
                this.DirectlyForwardToSpecialControl(specialControl);
            }
            else
            {
                this.activeAdornerChain.Attach();
            }
        }
예제 #3
0
        private void Show()
        {
            this.timer.Stop();

            // Check whether the window is
            // - still present (prevents exceptions when window is closed by system commands)
            // - still active (prevents keytips showing during Alt-Tab'ing)
            if (this.window == null ||
                this.window.IsActive == false)
            {
                this.RestoreFocus();
                return;
            }

            this.backUpFocusedControl = FocusWrapper.GetWrapperForCurrentFocus();

            // Focus ribbon
            this.ribbon.Focus();

            this.ClearUserInput();

            this.activeAdornerChain             = new KeyTipAdorner(this.ribbon, this.ribbon, null);
            this.activeAdornerChain.Terminated += this.OnAdornerChainTerminated;

            // Special behavior for backstage
            var specialControl = this.GetBackstage()
                                 ?? this.GetApplicationMenu()
                                 ?? this.GetStartScreen();

            if (specialControl != null)
            {
                this.DirectlyForwardToSpecialControl(specialControl);
            }
            else
            {
                this.activeAdornerChain.Attach();
            }
        }