From 812635079b1cff3d01441834b19b41867057efdb Mon Sep 17 00:00:00 2001 From: Scott Lerch Date: Tue, 14 Jul 2026 14:23:26 -0700 Subject: [PATCH] #79 Modern: adopt CornerRadius clip-escape workaround, drop status-bar backplate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The modern editor's entries ListView hits a WinUI 3 raster clip-escape bug (upstream microsoft-ui-xaml#11225): once content extent passes ~2^21 DIPs the renderer stops clipping bottom-edge rows and they paint over the status bar. The previous mitigation was an opaque backplate behind the status bar (StatusBackplateThreshold/StatusBackplateVisibility + a Border) that merely occluded the strays — cosmetic, and it dropped the true-Mica look on large files. Two responders on the upstream issue proposed a cleaner fix: give the ListView any non-zero CornerRadius, which forces a composition geometry clip on its content and re-establishes the bottom clip. CornerRadius="0.1" is visually indistinguishable from square and actually keeps rows inside the control, so it works with the transparent Mica band and no backplate is needed. - Add CornerRadius="0.1" to EntriesList. - Remove StatusBackplateThreshold, StatusBackplateVisibility, the backplate Border, and the two OnPropertyChanged(nameof(StatusBackplateVisibility)) calls. - Update the surrounding comments. Co-Authored-By: Claude Opus 4.8 --- HostsFileEditor.WinUI/MainWindow.xaml | 31 ++++++++++++------------ HostsFileEditor.WinUI/MainWindow.xaml.cs | 29 +--------------------- 2 files changed, 16 insertions(+), 44 deletions(-) diff --git a/HostsFileEditor.WinUI/MainWindow.xaml b/HostsFileEditor.WinUI/MainWindow.xaml index 70d6177..336b1e9 100644 --- a/HostsFileEditor.WinUI/MainWindow.xaml +++ b/HostsFileEditor.WinUI/MainWindow.xaml @@ -351,9 +351,19 @@ + + The WinUI raster clip-escape bug that used to spill list rows onto this band (issue #79, + upstream microsoft-ui-xaml#11225) is now held off at the source by the ListView's + CornerRadius="0.1" — see the comment on EntriesList above. That actually clips the rows, + so no opaque backplate is needed here and the true-Mica look is preserved at every list + size. --> - - Entries.Count * (Content?.XamlRoot?.RasterizationScale ?? 1.0) > StatusBackplateThreshold - ? Visibility.Visible - : Visibility.Collapsed; - // The status row is 0 while the archive view is shown: its content collapses via // MainViewVisibility, but a FIXED 32px grid row keeps its height regardless — which left a // permanent dead band of blank Mica under the archive panel. @@ -531,10 +515,6 @@ private void UpdateStatusCounts() _statusText = text; OnPropertyChanged(nameof(StatusText)); } - - // Cheap: x:Bind just re-reads Entries.Count and the rasterization scale. Raised on every - // recount so the backplate tracks the visible row count through loads, filters, and bulk edits. - OnPropertyChanged(nameof(StatusBackplateVisibility)); } // A filter change can swap the entire visible set, so rebuild it with a single bulk rebind @@ -782,14 +762,7 @@ void ApplyMinimumWindowSize() } xamlRootChangedHooked = true; - rootElement.XamlRoot.Changed += (_, _) => - { - ApplyMinimumWindowSize(); - - // The backplate trigger is scale-dependent too (raster-level escape — - // see StatusBackplateVisibility). - OnPropertyChanged(nameof(StatusBackplateVisibility)); - }; + rootElement.XamlRoot.Changed += (_, _) => ApplyMinimumWindowSize(); }; } }