Browse Source

fluent 2 - add listbox selection indicator keys

pull/21771/head
Emmanuel Hansen 3 weeks ago
parent
commit
e59348d6b8
  1. 29
      src/Avalonia.Themes.Fluent2/Controls/ListBoxItem.xaml

29
src/Avalonia.Themes.Fluent2/Controls/ListBoxItem.xaml

@ -25,6 +25,9 @@
<Thickness x:Key="ListBoxItemPadding">12,9,12,12</Thickness>
<x:Double x:Key="ListBoxItemMinHeight">40</x:Double>
<x:Double x:Key="ListBoxItemMinWidth">88</x:Double>
<x:Double x:Key="ListBoxItemSelectionIndicatorWidth">3</x:Double>
<x:Double x:Key="ListBoxItemSelectionIndicatorHeight">16</x:Double>
<x:Double x:Key="ListBoxItemSelectionIndicatorRadius">2</x:Double>
<ControlTheme x:Key="{x:Type ListBoxItem}" TargetType="ListBoxItem" BasedOn="{StaticResource FluentListBoxItemTheme}"/>
<ControlTheme x:Key="FluentListBoxItemTheme" TargetType="ListBoxItem">
<Setter Property="Background" Value="Transparent" />
@ -40,27 +43,27 @@
<!-- WinUI's ListViewItemPresenter insets the rounded backplate from the item bounds. -->
<Panel Margin="4,2">
<ContentPresenter Name="PART_ContentPresenter"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
Padding="{TemplateBinding Padding}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" />
<!-- Selection pill: WinUI animates its height 0 -> 16 over 167ms when the item is selected;
expressed here as a scaleY render transform so the animation doesn't run layout every
frame (technique from FluentAvalonia). ListViewItemSelectionIndicatorBrush is not aliased
in this theme yet, so the Fluent 2 token AccentFillColorDefaultBrush is referenced directly. -->
expressed here as a scaleY render transform so the animation doesn't run layout every
frame (technique from FluentAvalonia). ListViewItemSelectionIndicatorBrush is not aliased
in this theme yet, so the Fluent 2 token AccentFillColorDefaultBrush is referenced directly. -->
<Rectangle Name="SelectionIndicator"
IsVisible="False"
Width="3"
Height="16"
RadiusX="1.5"
RadiusY="1.5"
Width="{DynamicResource ListBoxItemSelectionIndicatorWidth}"
Height="{DynamicResource ListBoxItemSelectionIndicatorHeight}"
RadiusX="{DynamicResource ListBoxItemSelectionIndicatorRadius}"
RadiusY="{DynamicResource ListBoxItemSelectionIndicatorRadius}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
VerticalAlignment="Center"
IsHitTestVisible="False"
UseLayoutRounding="False"
RenderTransform="scaleY(0)"

Loading…
Cancel
Save