Browse Source

fluent 2 - fix treeview resources

pull/21771/head
Emmanuel Hansen 3 weeks ago
parent
commit
39f02b22f5
  1. 2
      src/Avalonia.Themes.Fluent2/Accents/FluentControlResources.xaml
  2. 29
      src/Avalonia.Themes.Fluent2/Controls/TreeViewItem.xaml

2
src/Avalonia.Themes.Fluent2/Accents/FluentControlResources.xaml

@ -614,6 +614,7 @@
<StaticResource x:Key="ScrollBarPanningThumbBackgroundColor" ResourceKey="ControlStrongFillColorDefault" /> <StaticResource x:Key="ScrollBarPanningThumbBackgroundColor" ResourceKey="ControlStrongFillColorDefault" />
<StaticResource x:Key="ScrollBarPanningThumbBackground" ResourceKey="ControlStrongFillColorDefaultBrush" /> <StaticResource x:Key="ScrollBarPanningThumbBackground" ResourceKey="ControlStrongFillColorDefaultBrush" />
<StaticResource x:Key="ScrollBarButtonBackgroundDisabled" ResourceKey="SubtleFillColorTransparentBrush" /> <StaticResource x:Key="ScrollBarButtonBackgroundDisabled" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="TreeViewItemSelectionIndicatorForeground" ResourceKey="AccentFillColorDefaultBrush" />
<x:Double x:Key="ScrollBarSize">12</x:Double> <x:Double x:Key="ScrollBarSize">12</x:Double>
<x:Double x:Key="ScrollBarButtonArrowIconFontSize">8</x:Double> <x:Double x:Key="ScrollBarButtonArrowIconFontSize">8</x:Double>
@ -1381,6 +1382,7 @@
<StaticResource x:Key="TreeViewItemBorderBrushSelectedPointerOver" ResourceKey="SubtleFillColorTransparentBrush" /> <StaticResource x:Key="TreeViewItemBorderBrushSelectedPointerOver" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="TreeViewItemBorderBrushSelectedPressed" ResourceKey="SubtleFillColorTransparentBrush" /> <StaticResource x:Key="TreeViewItemBorderBrushSelectedPressed" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="TreeViewItemBorderBrushSelectedDisabled" ResourceKey="SubtleFillColorTransparentBrush" /> <StaticResource x:Key="TreeViewItemBorderBrushSelectedDisabled" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="TreeViewItemSelectionIndicatorForeground" ResourceKey="AccentFillColorDefaultBrush" />
<Thickness x:Key="TreeViewItemBorderThemeThickness">0</Thickness> <Thickness x:Key="TreeViewItemBorderThemeThickness">0</Thickness>
<x:Double x:Key="TreeViewItemMinHeight">28</x:Double> <x:Double x:Key="TreeViewItemMinHeight">28</x:Double>

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

@ -45,7 +45,7 @@
VerticalAlignment="Center"> VerticalAlignment="Center">
<Path x:Name="ChevronPath" <Path x:Name="ChevronPath"
Data="{StaticResource TreeViewItemCollapsedChevronPathData}" Data="{StaticResource TreeViewItemCollapsedChevronPathData}"
Fill="{DynamicResource TextFillColorSecondaryBrush}" Fill="{TemplateBinding Foreground}"
Stretch="Uniform" Stretch="Uniform"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" /> VerticalAlignment="Center" />
@ -113,15 +113,13 @@
VerticalAlignment="{TemplateBinding VerticalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}"
Margin="{TemplateBinding Padding}" /> Margin="{TemplateBinding Padding}" />
</Grid> </Grid>
<!-- WinUI selection indicator pill: 3x16, fully rounded ends, accent fill,
pinned to the left edge of the row (before indentation). Scale-animated
like the ListBoxItem one. -->
<Rectangle Name="SelectionIndicator" <Rectangle Name="SelectionIndicator"
Width="3" Width="3"
Height="16" Height="16"
RadiusX="1.5" RadiusX="1.5"
RadiusY="1.5" RadiusY="1.5"
Fill="{DynamicResource AccentFillColorDefaultBrush}" Fill="{DynamicResource TreeViewItemSelectionIndicatorForeground}"
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Center" VerticalAlignment="Center"
UseLayoutRounding="False" UseLayoutRounding="False"
@ -150,6 +148,9 @@
<Style Selector="^ /template/ Border#PART_LayoutRoot:pointerover > ContentPresenter#PART_HeaderPresenter"> <Style Selector="^ /template/ Border#PART_LayoutRoot:pointerover > ContentPresenter#PART_HeaderPresenter">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundPointerOver}" /> <Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundPointerOver}" />
</Style> </Style>
<Style Selector="^ /template/ ToggleButton#PART_ExpandCollapseChevron">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundPointerOver}" />
</Style>
<!-- Pressed state --> <!-- Pressed state -->
<Style Selector="^:pressed /template/ Border#PART_LayoutRoot:pointerover"> <Style Selector="^:pressed /template/ Border#PART_LayoutRoot:pointerover">
@ -159,6 +160,9 @@
<Style Selector="^:pressed /template/ Border#PART_LayoutRoot:pointerover > ContentPresenter#PART_HeaderPresenter"> <Style Selector="^:pressed /template/ Border#PART_LayoutRoot:pointerover > ContentPresenter#PART_HeaderPresenter">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundPressed}" /> <Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundPressed}" />
</Style> </Style>
<Style Selector="^:pressed /template/ ToggleButton#PART_ExpandCollapseChevron">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundPressed}" />
</Style>
<!-- Disabled state --> <!-- Disabled state -->
<Style Selector="^:disabled /template/ Border#PART_LayoutRoot"> <Style Selector="^:disabled /template/ Border#PART_LayoutRoot">
@ -168,6 +172,9 @@
<Style Selector="^:disabled /template/ ContentPresenter#PART_HeaderPresenter"> <Style Selector="^:disabled /template/ ContentPresenter#PART_HeaderPresenter">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundDisabled}" /> <Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundDisabled}" />
</Style> </Style>
<Style Selector="^:disabled /template/ ToggleButton#PART_ExpandCollapseChevron">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundDisabled}" />
</Style>
<!-- Selected state --> <!-- Selected state -->
<Style Selector="^:selected /template/ Border#PART_LayoutRoot"> <Style Selector="^:selected /template/ Border#PART_LayoutRoot">
@ -177,6 +184,9 @@
<Style Selector="^:selected /template/ Border#PART_LayoutRoot > ContentPresenter#PART_HeaderPresenter"> <Style Selector="^:selected /template/ Border#PART_LayoutRoot > ContentPresenter#PART_HeaderPresenter">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundSelected}" /> <Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundSelected}" />
</Style> </Style>
<Style Selector="^:selected /template/ ToggleButton#PART_ExpandCollapseChevron">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundSelected}" />
</Style>
<!-- Selected PointerOver state --> <!-- Selected PointerOver state -->
<Style Selector="^:selected /template/ Border#PART_LayoutRoot:pointerover"> <Style Selector="^:selected /template/ Border#PART_LayoutRoot:pointerover">
@ -186,6 +196,9 @@
<Style Selector="^:selected /template/ Border#PART_LayoutRoot:pointerover > ContentPresenter#PART_HeaderPresenter"> <Style Selector="^:selected /template/ Border#PART_LayoutRoot:pointerover > ContentPresenter#PART_HeaderPresenter">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundSelectedPointerOver}" /> <Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundSelectedPointerOver}" />
</Style> </Style>
<Style Selector="^:selected /template/ ToggleButton#PART_ExpandCollapseChevron">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundSelectedPointerOver}" />
</Style>
<!-- Selected Pressed state --> <!-- Selected Pressed state -->
<Style Selector="^:pressed:selected /template/ Border#PART_LayoutRoot:pointerover"> <Style Selector="^:pressed:selected /template/ Border#PART_LayoutRoot:pointerover">
@ -195,6 +208,9 @@
<Style Selector="^:pressed:selected /template/ Border#PART_LayoutRoot:pointerover > ContentPresenter#PART_HeaderPresenter"> <Style Selector="^:pressed:selected /template/ Border#PART_LayoutRoot:pointerover > ContentPresenter#PART_HeaderPresenter">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundSelectedPressed}" /> <Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundSelectedPressed}" />
</Style> </Style>
<Style Selector="^:pressed:selected /template/ ToggleButton#PART_ExpandCollapseChevron">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundSelectedPressed}" />
</Style>
<!-- Disabled Selected state --> <!-- Disabled Selected state -->
<Style Selector="^:disabled:selected /template/ Border#PART_LayoutRoot"> <Style Selector="^:disabled:selected /template/ Border#PART_LayoutRoot">
@ -204,6 +220,9 @@
<Style Selector="^:disabled:selected /template/ Border#PART_LayoutRoot > ContentPresenter#PART_HeaderPresenter"> <Style Selector="^:disabled:selected /template/ Border#PART_LayoutRoot > ContentPresenter#PART_HeaderPresenter">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundSelectedDisabled}" /> <Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundSelectedDisabled}" />
</Style> </Style>
<Style Selector="^:disabled:selected /template/ ToggleButton#PART_ExpandCollapseChevron">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForegroundSelectedDisabled}" />
</Style>
<!-- Selection indicator pill (WinUI SelectionIndicator) --> <!-- Selection indicator pill (WinUI SelectionIndicator) -->
<Style Selector="^:selected /template/ Rectangle#SelectionIndicator"> <Style Selector="^:selected /template/ Rectangle#SelectionIndicator">

Loading…
Cancel
Save