I’m using WPF to write a program to use the entire screen. For the full screen effect, I wrote as
WindowStyle="None" WindowState="Maximized"
Everything seems OK but when I use the this.Width and this.Height somewhere in the code, it’s sometimes the value before the window is maximized. The code runs in some mouse event handlers, so the window should have already been maximized.
I said sometimes because it’s about 20% likely that it would happen on .NET Framework 4.5. But when I change the project property to .NET Framework 3.0 or 3.5, it happens 100% of the times.
I think this should be a bug of .NET Framework but I need to get things better anyway. Is it happening because I didn’t maximize the window properly? Or is there a better way to maximize a window to full screen?
PS. I’ve also tried this,
WindowStyle = WindowStyle.None;
WindowState = WindowState.Maximized;
but it’s still the same.
Try the
ActualWidthandActualHeightproperties.