Windows 10 Sleep Issue. Graphics disappear

I have a Windows UWP C # / XAML application that has a strange problem. When the display goes into sleep mode and I wake up the computer, some buttons disappear. I have a Windows 8 application that demonstrates the same behavior on Windows 10, but not on Windows 8. I want to try to create a workaround that updates the user interface elements when I wake up from sleep, but it's hard for me to find a trigger. I heard about this PowerModeChanged event , but I just can't find this API. Any ideas?

SystemEvents not found

+7
c # windows windows-10 hibernate xaml
source share
2 answers

I just wanted to add an answer that addresses the original problem in my question: graphics disappearing.

I had several image elements that had the same source URI (pointing to the same image). One of them was hidden, the other was not. Somehow, this led to the fact that the images completely disappeared. There must be something about how XAML handles image links, especially after pausing / waking up. I added? 1 to one of the image URIs, and the problem has been resolved.

+1
source share

If the API is not available, you can try to update the user interface based on mouse / keyboard activity after a period of inactivity for a certain amount of time, if this works, you need to have a wait time equal to the time it takes for the computer to sleep, another you can also try to catch the activated an event in your own application if it fires after sleep.

+1
source share

All Articles