Keko-7513 avatar image
0 Votes"
Keko-7513 asked Keko-7513 edited

WPF Application with WindowState Maximized and ResizeMode NoResize randomly switches into small window mode

I am developing a WPF App in .Net Framework 4.6.2.

I want the application to be in fullscreen mode which works fine for some time.

Sadly for some reason after running for multiple hours the application is set randomly to a resolution of 800x600 and leaves fullscreen mode.

Setting Fullscreeen is done inside the MainWindow by these lines of code.
Because the screen has a resolution of 1920x1080 i am setting the size of the window to this first,
so the application stays at the same size if its fullscreen mode is turned off externally somehow. At least that's what i hoped for.

                     Width = 1920;
                     Height = 1080;

                     WindowStyle = WindowStyle.None;
                     WindowState = WindowState.Maximized;

                     ResizeMode = ResizeMode.NoResize;

I did some testing and wrote an Application which creates a log entry each time the application in focus changes to make sure there's no other application causing the issue. But this souldn't even be possible with ResizeMode NoResize, right?

After doing some googling my current guess is that this is caused by the display or the graphics driver. Display is connected via DisplayPort. Maybe the display delivers a different EDID from time to time.

On further testing i realized that turning the screen off and on manually causes the issue. Now what i really do not understand is that the OS itself stays at 1920x1080. As far as my understanding goes, at WindowState Maximized the Application should resize when the screen resolution changes. I also could eliminate the issue temporarily (or at least wasn't able to reproduce it by turning the screen off and on) after changing the vertical refresh rate inside the intel graphics driver from 59Hz to 60Hz. But after reboot the issue was back. So maybe the graphics driver by Intel is causing the issue.

Also when the issue occurs, calling my method to set the application to fullscreen has no effect.

I have no clue where to continue, hope you can at least point me in the right direction.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Keko-7513 avatar image
0 Votes"
Keko-7513 answered Keko-7513 edited

After further testing i came to the follwing conclusion.

1) ResizeMode NoResize means the application still adaps to a reduction of the resolution, but not to an increased resolution.

2) I killed the Windows explorer while my application was runing in hope to reduce any window changes by keyboard inputs. But as my test shows the adaption of the window size to an increasing resolution seems to rely on the exploerer. When explorer is running and the WindowState is Maximized the application also resizes when the resolution is increased.

3) Seems like the issue originated from the display turning off and on automatically and the os reducing its resolution to 800x600.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.