From 99949c85a464101f20f9f40a142d70f8f8d30e51 Mon Sep 17 00:00:00 2001 From: Emmanuel Hansen Date: Wed, 9 Sep 2026 10:33:06 +0000 Subject: [PATCH] fluent2 - add list box classic theme --- .../Accents/FluentControlResources.xaml | 18 +++ .../Controls/ListBox.xaml | 46 ++++++- .../Controls/ListBoxItem.xaml | 127 ++++++++++++++---- 3 files changed, 164 insertions(+), 27 deletions(-) diff --git a/src/Avalonia.Themes.Fluent2/Accents/FluentControlResources.xaml b/src/Avalonia.Themes.Fluent2/Accents/FluentControlResources.xaml index 7f5fcf7172..e9bf878d81 100644 --- a/src/Avalonia.Themes.Fluent2/Accents/FluentControlResources.xaml +++ b/src/Avalonia.Themes.Fluent2/Accents/FluentControlResources.xaml @@ -175,6 +175,15 @@ 0 + + + + + + + + + 3 @@ -875,6 +884,15 @@ 0 + + + + + + + + + 3 diff --git a/src/Avalonia.Themes.Fluent2/Controls/ListBox.xaml b/src/Avalonia.Themes.Fluent2/Controls/ListBox.xaml index 70e6cd02b0..12359c0f51 100644 --- a/src/Avalonia.Themes.Fluent2/Controls/ListBox.xaml +++ b/src/Avalonia.Themes.Fluent2/Controls/ListBox.xaml @@ -12,9 +12,10 @@ - - + + + + @@ -38,7 +39,44 @@ VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}" IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}" IsScrollInertiaEnabled="{TemplateBinding (ScrollViewer.IsScrollInertiaEnabled)}" - IsDeferredScrollingEnabled="{TemplateBinding (ScrollViewer.IsDeferredScrollingEnabled)}" + IsDeferredScrollingEnabled="{TemplateBinding (ScrollViewer.IsDeferredScrollingEnabled)}" + AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}" + BringIntoViewOnFocusChange="{TemplateBinding (ScrollViewer.BringIntoViewOnFocusChange)}"> + + + + + + + + + + + + + + + + + + + + + - 12,0,12,0 + Rounded WinUI 3 list items: backplate inset from the list edges, CornerRadius 4, MinHeight 40, + transparent rest state, subtle-fill hover/press/selection and an accent selection pill + (3x16, r1.5, vertically centered on the left edge) that only shows when selected. + The 4,2 backplate inset and the pill metrics are baked into WinUI's ListViewItemPresenter + rather than exposed as theme resources, so they are approximated here from the WinUI visuals. --> + 12,0,12,0 + 12,9,12,12 40 - + 88 + + - - + + + + @@ -35,13 +40,12 @@ @@ -56,7 +60,7 @@ RadiusX="1.5" RadiusY="1.5" HorizontalAlignment="Left" - VerticalAlignment="Center" + VerticalAlignment="Center" IsHitTestVisible="False" UseLayoutRounding="False" RenderTransform="scaleY(0)" @@ -72,19 +76,19 @@ @@ -92,7 +96,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +