From 3a5e98c0997a960f718165ff4abdfe44dc5995e7 Mon Sep 17 00:00:00 2001 From: Bastian Schmidt Date: Fri, 25 Jan 2019 09:24:24 +0100 Subject: [PATCH] Fixes #688 by adding new Popup-Dismiss-Reason for KeyTips --- Changelog.md | 1 + Fluent.Ribbon/Controls/Backstage.cs | 6 ++++-- Fluent.Ribbon/Services/KeyTipService.cs | 2 +- Fluent.Ribbon/Services/PopupService.cs | 7 ++++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index 2c668648d..a221513ec 100644 --- a/Changelog.md +++ b/Changelog.md @@ -116,6 +116,7 @@ - [#666](../../issues/666) - InRibbonGallery DropDown not layouting correctly - [#673](../../issues/673) - RibbonContextualTabGroup not shown - [#677](../../issues/677) - Alt Codes no longer working in alpha version v7.0.0 + - [#688](../../issues/688) - Backstage and StartScreen closing when pressing Alt - ### Enhancements/Features - [#516](../../issues/516) - Add options to hide the row containing RibbonTabItems diff --git a/Fluent.Ribbon/Controls/Backstage.cs b/Fluent.Ribbon/Controls/Backstage.cs index 3d790919d..066658131 100644 --- a/Fluent.Ribbon/Controls/Backstage.cs +++ b/Fluent.Ribbon/Controls/Backstage.cs @@ -266,8 +266,10 @@ private void Handle_DataContextChanged(object sender, DependencyPropertyChangedE /// protected virtual void OnDismissPopup(object sender, DismissPopupEventArgs e) { - // don't close on dismiss popup event if application lost focus - if (e.DismissReason == DismissPopupReason.ApplicationLostFocus) + // Don't close on dismiss popup event if application lost focus + // or keytips should be shown. + if (e.DismissReason == DismissPopupReason.ApplicationLostFocus + || e.DismissReason == DismissPopupReason.ShowingKeyTips) { return; } diff --git a/Fluent.Ribbon/Services/KeyTipService.cs b/Fluent.Ribbon/Services/KeyTipService.cs index 060fcc47d..4e2acedaf 100644 --- a/Fluent.Ribbon/Services/KeyTipService.cs +++ b/Fluent.Ribbon/Services/KeyTipService.cs @@ -379,7 +379,7 @@ private void ClearUserInput() private void ClosePopups() { - PopupService.RaiseDismissPopupEvent(Keyboard.FocusedElement, DismissPopupMode.Always); + PopupService.RaiseDismissPopupEvent(Keyboard.FocusedElement, DismissPopupMode.Always, DismissPopupReason.ShowingKeyTips); } private void RestoreFocus() diff --git a/Fluent.Ribbon/Services/PopupService.cs b/Fluent.Ribbon/Services/PopupService.cs index c4a4e8ad2..b3425fd11 100644 --- a/Fluent.Ribbon/Services/PopupService.cs +++ b/Fluent.Ribbon/Services/PopupService.cs @@ -39,7 +39,12 @@ public enum DismissPopupReason /// /// Application lost focus. /// - ApplicationLostFocus + ApplicationLostFocus, + + /// + /// Showing key tips. + /// + ShowingKeyTips } ///