internal static (Size min, Size max) GetMinMax(this IFrameworkElement e) { var size = new Size(e.Width, e.Height); var minSize = e.GetMinSize(); var maxSize = e.GetMaxSize(); minSize = size .NumberOrDefault(new Size(0, 0)) .AtMost(maxSize) .AtLeast(minSize); // UWP is applying "min" after "max", so if "min" > "max", "min" wins maxSize = size .NumberOrDefault(new Size(PositiveInfinity, PositiveInfinity)) .AtMost(maxSize) .AtLeast(minSize); // UWP is applying "min" after "max", so if "min" > "max", "min" wins return(minSize, maxSize); }
internal static (Size min, Size max) GetMinMax(this IFrameworkElement e) { var size = new Size(e.Width, e.Height); var minSize = e.GetMinSize(); var maxSize = e.GetMaxSize(); minSize = size .NumberOrDefault(new Size(0, 0)) .AtMost(maxSize) .AtLeast(minSize); maxSize = size .NumberOrDefault(new Size(PositiveInfinity, PositiveInfinity)) .AtMost(maxSize) .AtLeast(minSize); return(minSize, maxSize); }