From aa682d5e2b4cfffbd5fae2577c5cb7c7342501e8 Mon Sep 17 00:00:00 2001 From: Tyler Ortiz Date: Tue, 11 Apr 2023 11:37:31 -0700 Subject: [PATCH] Fix issue with Windows 11 ListViewStyle Issue in WinUI where Windows 11 ListView does not apply alternate row background until hover. --- .../ListViewExtensions.AlternateRows.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Microsoft.Toolkit.Uwp.UI/Extensions/ListViewBase/ListViewExtensions.AlternateRows.cs b/Microsoft.Toolkit.Uwp.UI/Extensions/ListViewBase/ListViewExtensions.AlternateRows.cs index 53d7355371f..c0fd52cf564 100644 --- a/Microsoft.Toolkit.Uwp.UI/Extensions/ListViewBase/ListViewExtensions.AlternateRows.cs +++ b/Microsoft.Toolkit.Uwp.UI/Extensions/ListViewBase/ListViewExtensions.AlternateRows.cs @@ -211,11 +211,22 @@ private static void SetItemContainerBackground(Windows.UI.Xaml.Controls.ListView if (itemIndex % 2 == 0) { itemContainer.Background = GetAlternateColor(sender); + var rootBorder = itemContainer.FindDescendant(); + if (rootBorder != null) + { + rootBorder.Background = GetAlternateColor(sender); + } } else { itemContainer.Background = null; + + var rootBorder = itemContainer.FindDescendant(); + if (rootBorder != null) + { + rootBorder.Background = null; + } } } } -} \ No newline at end of file +}