Try this instead it
await ApplicationView.GetForCurrentView().TryConsolidateAsync();
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
In my app, in the menu I have the Exit button (MenyFlyoutItem). I use this code for this button to work: CoreApplication.Exit();
It works just great, but I've noticed that right before my app closes it kind of flashes for a second and the app is colored with the accent color of my system. It happens really fast, but it is noticeable. It also sometimes happens when I expand my app. I've noticed the same thing with many UWP apps, including the apps from Microsoft. Is this a bug or something? Here's what it looks like in my app:
EDIT:
So, I just tried to create an UWP app with C++ and I added the regular Exit button on the MainPage and used this code for this button: Application::Current->Exit();
and I get the same bug when I click the button. I assume, the bug is not relevant to any code or language specifically, but relevant to UWP apps. Also, I should probably mention that I experience it on Windows 11. I don't remember whether or not it was a thing on Windows 10. I would love to know whether or not this kind of behavior is normal for UWP apps, or it's something to do with my system specifically? Maybe there's a way to fix this?
Try this instead it
await ApplicationView.GetForCurrentView().TryConsolidateAsync();