When I create windows I'm restricting their position so that the window never gets too far off the browser. I'm allowing it to move up to 75% of its size, except the top that is 0.
double width = window.MinWidth == 0 || window.MinWidth == double.NaN ?
(window.Width == 0 || window.Width == double.NaN ? window.Width : window.MaxWidth) : window.MinWidth;
double height = window.MinHeight == 0 || window.MinHeight == double.NaN ?
(window.Height == 0 || window.Height == double.NaN ? window.Height : window.MaxHeight) : window.MinHeight;
window.RestrictedAreaMargin = new Thickness(-width * RestrictedWidthFactor, 0, -width * RestrictedWidthFactor, -height * RestrictedHeightFactor);
window.IsRestricted = true;
RestrictedWidthFactor = 0.75 and RestrictedHeightFactor = 0.75. Usually the Thickness object ends up with -8xx, 0, -8xx, -5xx.
When I maximize the window the Left position stays at -8xx instead of 0, so the window appears almost half off the screen and because it is maximized we cannot move it. Am I doing something wrong? To fix the issue I register for the WindowStateChanged event and when Maximized I set the Left property to 0 and it works fine.