feat: replace TreeDataGrid icon.

This commit is contained in:
Zhang Dian
2025-03-16 16:44:07 +08:00
parent 6cda56a830
commit 67c0db10ac
2 changed files with 14 additions and 31 deletions

View File

@@ -1,9 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StreamGeometry x:Key="TreeDataGridSortIconAscendingPath">m6.45 8.34 4.8-5.48a1 1 0 0 1 1.5 0l4.8 5.48A1 1 0 0 1 16.8 10H7.2a1 1 0 0 1-.75-1.66Z</StreamGeometry> <StaticResource x:Key="TreeDataGridSortIconAscendingPath" ResourceKey="SemiIconSmallTriangleTop"/>
<StreamGeometry x:Key="TreeDataGridSortIconDescendingPath">m17.55 15.66-4.8 5.48a1 1 0 0 1-1.5 0l-4.8-5.48A1 1 0 0 1 7.2 14h9.6a1 1 0 0 1 .75 1.66Z</StreamGeometry> <StaticResource x:Key="TreeDataGridSortIconDescendingPath" ResourceKey="SemiIconSmallTriangleDown"/>
<StreamGeometry x:Key="TreeDataGridItemCollapsedChevronPathData">m9.66 3.44 8.97 7.8a1 1 0 0 1 0 1.51l-8.97 7.81A1 1 0 0 1 8 19.81V4.19a1 1 0 0 1 1.66-.75Z</StreamGeometry> <StaticResource x:Key="TreeDataGridItemCollapsedChevronPathData" ResourceKey="SemiIconTreeTriangleRight"/>
<!-- <StaticResource x:Key="TreeDataGridSortIconAscendingPath" ResourceKey="SemiIconCaretUp"/> -->
<!-- <StaticResource x:Key="TreeDataGridSortIconDescendingPath" ResourceKey="SemiIconCaretDown"/> -->
<!-- <StaticResource x:Key="TreeDataGridItemCollapsedChevronPathData" ResourceKey="SemiIconTreeTriangleRight"/> -->
<Thickness x:Key="TreeDataGridRowMargin">2</Thickness> <Thickness x:Key="TreeDataGridRowMargin">2</Thickness>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -87,11 +87,8 @@
</Panel> </Panel>
<PathIcon <PathIcon
Name="SortIcon" Name="SortIcon"
Width="8" Theme="{StaticResource InnerPathIcon}"
Height="8"
Margin="0,0,8,0" Margin="0,0,8,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
DockPanel.Dock="Right" DockPanel.Dock="Right"
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
TabIndex="1" /> TabIndex="1" />
@@ -192,25 +189,17 @@
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="TreeDataGridExpandCollapseChevron" TargetType="ToggleButton"> <ControlTheme x:Key="TreeDataGridExpandCollapseChevron" TargetType="ToggleButton">
<Setter Property="Margin" Value="0" />
<Setter Property="Width" Value="8" />
<Setter Property="Height" Value="8" />
<Setter Property="Foreground" Value="{DynamicResource TreeDataGridColumnHeaderForeground}" /> <Setter Property="Foreground" Value="{DynamicResource TreeDataGridColumnHeaderForeground}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border <PathIcon
Name="ChevronPath"
Width="{TemplateBinding Width}" Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}" Height="{TemplateBinding Height}"
HorizontalAlignment="Center" Theme="{StaticResource InnerPathIcon}"
VerticalAlignment="Center" Classes="Small"
Background="Transparent"> Data="{DynamicResource TreeDataGridItemCollapsedChevronPathData}"
<PathIcon Foreground="{TemplateBinding Foreground}" />
Name="ChevronPath"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="{DynamicResource TreeDataGridItemCollapsedChevronPathData}"
Foreground="{TemplateBinding Foreground}" />
</Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Style Selector="^:checked /template/ PathIcon#ChevronPath"> <Style Selector="^:checked /template/ PathIcon#ChevronPath">
@@ -223,18 +212,15 @@
<ControlTemplate> <ControlTemplate>
<Border <Border
Name="CellBorder" Name="CellBorder"
Padding="{TemplateBinding Indent, Padding="{TemplateBinding Indent,Converter={x:Static conv:IndentConverter.Instance}}"
Converter={x:Static conv:IndentConverter.Instance}}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"> CornerRadius="{TemplateBinding CornerRadius}">
<DockPanel> <DockPanel>
<Border <Border
Width="12" DockPanel.Dock="Left"
Height="12" Margin="4,0">
Margin="4,0"
DockPanel.Dock="Left">
<ToggleButton <ToggleButton
Focusable="False" Focusable="False"
IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}"
@@ -335,4 +321,4 @@
</Setter> </Setter>
</Style> </Style>
</ControlTheme> </ControlTheme>
</ResourceDictionary> </ResourceDictionary>