TemplateStudio
                                
                                
                                
                                    TemplateStudio copied to clipboard
                            
                            
                            
                        App is not brought to foreground when App Notification is invoked
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
- Create a project using AppNotifications.
 - Launch a toast notification.
 - Let the app window fall out of focus/bring another application into the foreground.
 - Click on the notification.
 
Additional context
No response
Applies to the following platforms:
- [X] WinUI
 - [ ] WPF
 - [ ] UWP
 
About your setup
No response
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.
Remaining work here to improve the experience is likely in the platform.
Platform work tracked by https://task.ms/40476788.