microsoft / TemplateStudio

Template Studio accelerates the creation of new WinUI 3, WPF, and UWP apps using a wizard-based experience.
Other
2.7k stars 461 forks source link

App is not brought to foreground when App Notification is invoked #4558

Open smorin4 opened 2 years ago

smorin4 commented 2 years ago

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:

About your setup

No response

mikebattista commented 2 years ago

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 commented 2 years ago

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

mikebattista commented 2 years ago

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