TemplateStudio icon indicating copy to clipboard operation
TemplateStudio copied to clipboard

App is not brought to foreground when App Notification is invoked

Open smorin4 opened this issue 3 years ago • 3 comments

Describe the bug

App is not brought to foreground when toast notification (using Microsoft.Windows.AppNotifications) is clicked. Notification is still functional for navigation and launching.

Possible solution: #4529

To Reproduce

  1. Create a project using AppNotifications.
  2. Launch a toast notification.
  3. Let the app window fall out of focus/bring another application into the foreground.
  4. Click on the notification.

Additional context

No response

Applies to the following platforms:

  • [X] WinUI
  • [ ] WPF
  • [ ] UWP

About your setup

No response

smorin4 avatar Jul 01 '22 20:07 smorin4

Added App.MainWindow.BringToFront() in OnNotificationInvoked with https://github.com/microsoft/TemplateStudio/pull/4557/commits/31f363869720d42a0bc20261e124ac597cc3f151.

Usually this just results in the taskbar icon flashing which is by design behavior for SetForegroundWindow APIs. Open question about if the shell can bring the app to the foreground automatically.

mikebattista avatar Jul 07 '22 20:07 mikebattista

Remaining work here to improve the experience is likely in the platform.

mikebattista avatar Jul 12 '22 17:07 mikebattista

Platform work tracked by https://task.ms/40476788.

mikebattista avatar Jul 15 '22 18:07 mikebattista