Skip to content

Commit

Permalink
Feature [DYN-5197] dismiss NotificationsPanel by clicking outside the…
Browse files Browse the repository at this point in the history
… panel (#14680)

* feat(NotificationCenterController): add PreviewMouseDown to dismiss notifications panel by clicking outside the panel

* unsuscribe DynamoView_PreviewMouseDown event handler
  • Loading branch information
Enzo707 authored Dec 5, 2023
1 parent 02cd5a4 commit 3ffbb38
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Notifications/NotificationCenterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ internal NotificationCenterController(DynamoView view, DynamoLogger dynLogger)
dynamoView.LocationChanged += DynamoView_LocationChanged;
notificationsButton.Click += NotificationsButton_Click;
dynamoView.Closing += View_Closing;
dynamoView.PreviewMouseDown += DynamoView_PreviewMouseDown;

notificationUIPopup = new NotificationUI
{
Expand All @@ -106,6 +107,7 @@ internal NotificationCenterController(DynamoView view, DynamoLogger dynLogger)
private void View_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
dynamoView.Closing -= View_Closing;
dynamoView.PreviewMouseDown -= DynamoView_PreviewMouseDown;
SuspendCoreWebviewAsync();
}

Expand Down Expand Up @@ -276,6 +278,17 @@ private void DynamoView_SizeChanged(object sender, SizeChangedEventArgs e)
notificationUIPopup.UpdatePopupLocation();
}

/// <summary>
/// Dismiss notifications panel by clicking outside the panel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DynamoView_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (!notificationUIPopup.IsOpen) return;
notificationUIPopup.IsOpen = false;
}

/// <summary>
/// Notification Center button click handler
/// </summary>
Expand Down

0 comments on commit 3ffbb38

Please sign in to comment.