Reputation: 2071
I'm having some problem with getting window size of MahApps window.
It's working perfectly when not maximized, but if I maximize it, it's too high;
I have code behind like this:
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
{
base.OnRenderSizeChanged(sizeInfo);
UpRect1.Width = ActualWidth;
}
And in ActualWidth
property is proper value when windows IS NOT maximized, but if I maximize window i get higher value than my resolution is (I have 1366 screen width, it returns 1382).
Is it some kind of bug, or it's standard Windows crazy behaviour?
P.S.
Same stuff with height
P.S 2
I have also checked with Width
property, but it's not updated on resize
Upvotes: 0
Views: 131
Reputation: 5078
That's the normal behaviour of Windows and has nothing to do with MahApps.Metro. See Raymond Chen's "Why are the dimensions of a maximized window larger than the monitor?":
The extra eight pixels that hang off the screen are the window borders. When you maximize a window, the window manager arranges things so that the client area of the window fills the width of your work area, and it plus the caption bar fills the height of the work area. After all, you want to see as much of your document as possible; there's no need to show you the window borders that aren't doing you any good. (It leaves the caption bar on the screen for obvious reasons.)
Upvotes: 1