From fbf48d6d25400cc33701c4a5d42313fd4f8d1558 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Mon, 13 Dec 2021 19:28:32 -0600 Subject: [PATCH] Fixed an issue where InAppNotification couldn't be dismissing programatically after canceling the closing event. --- .../InAppNotification/InAppNotification.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Core/InAppNotification/InAppNotification.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Core/InAppNotification/InAppNotification.cs index 67852665cc9..f70519160ed 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Core/InAppNotification/InAppNotification.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Core/InAppNotification/InAppNotification.cs @@ -184,6 +184,14 @@ private void Dismiss(InAppNotificationDismissKind dismissKind, bool dismissAll = return; } + var closingEventArgs = new InAppNotificationClosingEventArgs(dismissKind); + Closing?.Invoke(this, closingEventArgs); + + if (closingEventArgs.Cancel) + { + return; + } + _dismissTimer.Stop(); // Dismiss all if requested @@ -212,14 +220,6 @@ private void Dismiss(InAppNotificationDismissKind dismissKind, bool dismissAll = return; } - var closingEventArgs = new InAppNotificationClosingEventArgs(dismissKind); - Closing?.Invoke(this, closingEventArgs); - - if (closingEventArgs.Cancel) - { - return; - } - var result = VisualStateManager.GoToState(this, StateContentCollapsed, true); if (!result) {