diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/AdaptiveGridView/AdaptiveGridView.cs b/Microsoft.Toolkit.Uwp.UI.Controls/AdaptiveGridView/AdaptiveGridView.cs index f7e73880c71..bc8936762bd 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/AdaptiveGridView/AdaptiveGridView.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/AdaptiveGridView/AdaptiveGridView.cs @@ -105,6 +105,11 @@ protected virtual double CalculateItemWidth(double containerWidth) return DesiredWidth; } + // Remove 1 "device pixel" from the container width to account for + // weird scaling issues and flickering on higher DPI monitors #1803 + var info = Windows.Graphics.Display.DisplayInformation.GetForCurrentView(); + containerWidth = containerWidth - (1 * info.RawPixelsPerViewPixel); + var columns = CalculateColumns(containerWidth, DesiredWidth); // If there's less items than there's columns, reduce the column count (if requested); @@ -264,9 +269,7 @@ private void RecalculateLayout(double containerWidth) if (containerWidth > 0) { var newWidth = CalculateItemWidth(containerWidth); - - // Need to subtract one here for #1803 to not fight internal panel layout with odd DPI multiple (e.g. 125%) - ItemWidth = Math.Max(Math.Floor(newWidth) - 1, 0); + ItemWidth = Math.Floor(newWidth); } } }