Amend how we hide via deactivation as the user may still want to call Hide explicitly while having IsLightDismissedEnabled set to false

This commit is contained in:
Daniel Clark
2021-02-27 15:38:09 +00:00
parent f9c688aa02
commit 1800eefd5a
3 changed files with 9 additions and 3 deletions
@@ -2,7 +2,8 @@
x:Class="NotificationFlyoutSample.SampleFlyout"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:TheXamlGuy.NotificationFlyout.Uwp.UI.Controls">
xmlns:controls="using:TheXamlGuy.NotificationFlyout.Uwp.UI.Controls"
IsLightDismissEnabled="False">
<controls:NotificationFlyout.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Click="OnCloseMenuFlyoutItemClick" Text="Close" />
@@ -69,9 +69,14 @@ namespace TheXamlGuy.NotificationFlyout.Uwp.UI.Controls
PreparePopup();
}
_popup.IsOpen = false;
}
internal void TryHide()
{
if (IsLightDismissEnabled)
{
_popup.IsOpen = false;
Hide();
}
}
@@ -126,7 +126,7 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls
private void OnNotificationFlyoutXamlHostDeactivated(object sender, EventArgs args)
{
if (Flyout == null) return;
Flyout.Hide();
Flyout.TryHide();
}
private void ShowFlyout()