2023-07-25 23:15:55 +08:00
|
|
|
<ResourceDictionary
|
|
|
|
xmlns="https://github.com/avaloniaui"
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
xmlns:conv="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls.TreeDataGrid">
|
2024-12-02 16:52:03 +08:00
|
|
|
<!-- Add Resources Here -->
|
2023-07-26 01:23:05 +08:00
|
|
|
<Design.PreviewWith>
|
|
|
|
<StackPanel Margin="20">
|
|
|
|
<TreeDataGridColumnHeader Header="123" />
|
|
|
|
</StackPanel>
|
|
|
|
</Design.PreviewWith>
|
2023-07-25 23:15:55 +08:00
|
|
|
<ControlTheme x:Key="{x:Type TreeDataGrid}" TargetType="TreeDataGrid">
|
|
|
|
<Setter Property="Template">
|
2023-07-26 02:50:01 +08:00
|
|
|
<ControlTemplate TargetType="TreeDataGrid">
|
2023-07-25 23:15:55 +08:00
|
|
|
<Border
|
2024-11-07 17:56:29 +08:00
|
|
|
Name="RootBorder"
|
2023-07-25 23:15:55 +08:00
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
CornerRadius="{TemplateBinding CornerRadius}">
|
|
|
|
<DockPanel>
|
|
|
|
<ScrollViewer
|
|
|
|
Name="PART_HeaderScrollViewer"
|
|
|
|
DockPanel.Dock="Top"
|
|
|
|
HorizontalScrollBarVisibility="Hidden"
|
|
|
|
IsVisible="{TemplateBinding ShowColumnHeaders}"
|
|
|
|
VerticalScrollBarVisibility="Disabled">
|
2024-11-07 17:56:29 +08:00
|
|
|
<Border Name="ColumnHeadersPresenterBorder">
|
2023-07-25 23:15:55 +08:00
|
|
|
<TreeDataGridColumnHeadersPresenter
|
|
|
|
Name="PART_ColumnHeadersPresenter"
|
|
|
|
ElementFactory="{TemplateBinding ElementFactory}"
|
|
|
|
Items="{TemplateBinding Columns}" />
|
|
|
|
</Border>
|
|
|
|
</ScrollViewer>
|
|
|
|
<ScrollViewer Name="PART_ScrollViewer" HorizontalScrollBarVisibility="Auto">
|
|
|
|
<TreeDataGridRowsPresenter
|
|
|
|
Name="PART_RowsPresenter"
|
|
|
|
Columns="{TemplateBinding Columns}"
|
|
|
|
ElementFactory="{TemplateBinding ElementFactory}"
|
|
|
|
Items="{TemplateBinding Rows}" />
|
|
|
|
</ScrollViewer>
|
|
|
|
</DockPanel>
|
|
|
|
</Border>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter>
|
|
|
|
<Style Selector="^/template/ Border#ColumnHeadersPresenterBorder">
|
|
|
|
<Setter Property="BorderThickness" Value="0 0 0 1" />
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource TreeDataGridGridLinesBrush}" />
|
|
|
|
</Style>
|
|
|
|
</ControlTheme>
|
|
|
|
|
|
|
|
<ControlTheme x:Key="{x:Type TreeDataGridColumnHeader}" TargetType="TreeDataGridColumnHeader">
|
|
|
|
<Setter Property="Background" Value="Transparent" />
|
2023-07-26 01:23:05 +08:00
|
|
|
<Setter Property="MinHeight" Value="32" />
|
|
|
|
<Setter Property="Padding" Value="8 2 0 2" />
|
2023-07-26 02:50:01 +08:00
|
|
|
<Setter Property="Cursor" Value="Hand" />
|
2023-07-26 01:23:05 +08:00
|
|
|
<Setter Property="CornerRadius" Value="4" />
|
2023-07-25 23:15:55 +08:00
|
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
2023-07-26 01:23:05 +08:00
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TreeDataGridColumnHeaderForeground}" />
|
2023-07-25 23:15:55 +08:00
|
|
|
<Setter Property="Template">
|
2023-07-26 02:50:01 +08:00
|
|
|
<ControlTemplate TargetType="TreeDataGridColumnHeader">
|
2023-07-26 01:23:05 +08:00
|
|
|
<Panel>
|
|
|
|
<Border
|
|
|
|
Name="DataGridBorder"
|
|
|
|
Margin="4"
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
2023-07-25 23:15:55 +08:00
|
|
|
<DockPanel VerticalAlignment="Stretch">
|
|
|
|
<Panel DockPanel.Dock="Right" TabIndex="2">
|
|
|
|
<Rectangle
|
|
|
|
Width="1"
|
|
|
|
HorizontalAlignment="Right"
|
|
|
|
Fill="{DynamicResource TreeDataGridGridLinesBrush}" />
|
|
|
|
<Thumb
|
|
|
|
Name="PART_Resizer"
|
|
|
|
Width="5"
|
|
|
|
Background="Transparent"
|
|
|
|
Cursor="SizeWestEast"
|
|
|
|
DockPanel.Dock="Right"
|
|
|
|
IsVisible="{TemplateBinding CanUserResize}">
|
|
|
|
<Thumb.Template>
|
|
|
|
<ControlTemplate>
|
|
|
|
<Border VerticalAlignment="Stretch" Background="{TemplateBinding Background}" />
|
|
|
|
</ControlTemplate>
|
|
|
|
</Thumb.Template>
|
|
|
|
</Thumb>
|
|
|
|
</Panel>
|
2023-07-26 01:23:05 +08:00
|
|
|
<PathIcon
|
2023-07-25 23:15:55 +08:00
|
|
|
Name="SortIcon"
|
2023-07-26 01:23:05 +08:00
|
|
|
Width="8"
|
|
|
|
Height="8"
|
|
|
|
Margin="0,0,8,0"
|
2023-07-25 23:15:55 +08:00
|
|
|
HorizontalAlignment="Center"
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
DockPanel.Dock="Right"
|
2023-07-26 01:23:05 +08:00
|
|
|
Foreground="{TemplateBinding Foreground}"
|
2023-07-25 23:15:55 +08:00
|
|
|
TabIndex="1" />
|
|
|
|
<ContentPresenter
|
|
|
|
Name="PART_ContentPresenter"
|
|
|
|
Padding="{TemplateBinding Padding}"
|
|
|
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
|
|
Content="{TemplateBinding Header}"
|
|
|
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
|
|
TabIndex="0">
|
|
|
|
<ContentPresenter.DataTemplates>
|
|
|
|
<DataTemplate DataType="x:String">
|
|
|
|
<TextBlock Text="{Binding}" TextTrimming="CharacterEllipsis" />
|
|
|
|
</DataTemplate>
|
|
|
|
</ContentPresenter.DataTemplates>
|
|
|
|
</ContentPresenter>
|
|
|
|
</DockPanel>
|
2023-07-26 01:23:05 +08:00
|
|
|
</Panel>
|
2023-07-25 23:15:55 +08:00
|
|
|
</ControlTemplate>
|
|
|
|
</Setter>
|
|
|
|
|
|
|
|
<Style Selector="^:pointerover /template/ Border#DataGridBorder">
|
2023-07-26 02:50:01 +08:00
|
|
|
<Setter Property="Background" Value="{DynamicResource TreeDataGridHeaderPointerOverBackground}" />
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource TreeDataGridHeaderPointerOverBorderBrush}" />
|
|
|
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource TreeDataGridHeaderPointerOverForeground}" />
|
2023-07-25 23:15:55 +08:00
|
|
|
</Style>
|
|
|
|
|
|
|
|
<Style Selector="^:pressed /template/ Border#DataGridBorder">
|
2023-07-26 02:50:01 +08:00
|
|
|
<Setter Property="Background" Value="{DynamicResource TreeDataGridHeaderPressedBackground}" />
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource TreeDataGridHeaderPressedBorderBrush}" />
|
|
|
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource TreeDataGridHeaderPressedForeground}" />
|
2023-07-25 23:15:55 +08:00
|
|
|
</Style>
|
|
|
|
|
2023-07-26 01:23:05 +08:00
|
|
|
<Style Selector="^[SortDirection=Ascending] /template/ PathIcon#SortIcon">
|
2023-07-25 23:15:55 +08:00
|
|
|
<Setter Property="IsVisible" Value="True" />
|
|
|
|
<Setter Property="Data" Value="{DynamicResource TreeDataGridSortIconAscendingPath}" />
|
|
|
|
</Style>
|
|
|
|
|
2023-07-26 01:23:05 +08:00
|
|
|
<Style Selector="^[SortDirection=Descending] /template/ PathIcon#SortIcon">
|
2023-07-25 23:15:55 +08:00
|
|
|
<Setter Property="IsVisible" Value="True" />
|
|
|
|
<Setter Property="Data" Value="{DynamicResource TreeDataGridSortIconDescendingPath}" />
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
</ControlTheme>
|
|
|
|
|
|
|
|
<ControlTheme x:Key="{x:Type TreeDataGridRow}" TargetType="TreeDataGridRow">
|
2023-07-26 02:50:01 +08:00
|
|
|
<Setter Property="Background" Value="Transparent" />
|
|
|
|
<Setter Property="CornerRadius" Value="3" />
|
|
|
|
<Setter Property="MinHeight" Value="32" />
|
|
|
|
<Setter Property="Cursor" Value="Hand" />
|
2023-07-25 23:15:55 +08:00
|
|
|
<Setter Property="Template">
|
|
|
|
<ControlTemplate>
|
2023-07-26 02:50:01 +08:00
|
|
|
<Panel>
|
|
|
|
<Border
|
|
|
|
Name="RowBorder"
|
2024-07-15 22:36:55 +08:00
|
|
|
Margin="{DynamicResource TreeDataGridRowMargin}"
|
2023-07-26 02:50:01 +08:00
|
|
|
HorizontalAlignment="Stretch"
|
|
|
|
VerticalAlignment="Stretch"
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
2023-07-25 23:15:55 +08:00
|
|
|
<TreeDataGridCellsPresenter
|
|
|
|
Name="PART_CellsPresenter"
|
|
|
|
ElementFactory="{TemplateBinding ElementFactory}"
|
|
|
|
Items="{TemplateBinding Columns}"
|
|
|
|
Rows="{TemplateBinding Rows}" />
|
2023-07-26 02:50:01 +08:00
|
|
|
</Panel>
|
2023-07-25 23:15:55 +08:00
|
|
|
</ControlTemplate>
|
|
|
|
</Setter>
|
2023-07-26 02:50:01 +08:00
|
|
|
<Style Selector="^:selected /template/ Border#RowBorder">
|
|
|
|
<Setter Property="Background" Value="{DynamicResource TreeDataGridCellSelectedBackground}" />
|
2023-07-25 23:15:55 +08:00
|
|
|
</Style>
|
|
|
|
</ControlTheme>
|
|
|
|
|
|
|
|
<ControlTheme x:Key="{x:Type TreeDataGridCheckBoxCell}" TargetType="TreeDataGridCheckBoxCell">
|
|
|
|
<Setter Property="Padding" Value="4 2" />
|
|
|
|
<Setter Property="Template">
|
|
|
|
<ControlTemplate>
|
|
|
|
<Border
|
2024-11-07 17:56:29 +08:00
|
|
|
Name="CellBorder"
|
2023-07-25 23:15:55 +08:00
|
|
|
Padding="{TemplateBinding Padding}"
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
CornerRadius="{TemplateBinding CornerRadius}">
|
|
|
|
<CheckBox
|
2023-07-26 03:04:10 +08:00
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
|
|
|
VerticalAlignment="Center"
|
2024-07-15 22:36:55 +08:00
|
|
|
IsChecked="{TemplateBinding Value, Mode=TwoWay}"
|
2023-07-25 23:15:55 +08:00
|
|
|
IsEnabled="{Binding !IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
|
2023-07-26 02:50:01 +08:00
|
|
|
IsThreeState="{TemplateBinding IsThreeState}"
|
|
|
|
Theme="{DynamicResource SimpleCheckBox}" />
|
2023-07-25 23:15:55 +08:00
|
|
|
</Border>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter>
|
|
|
|
</ControlTheme>
|
|
|
|
|
|
|
|
<ControlTheme x:Key="TreeDataGridExpandCollapseChevron" TargetType="ToggleButton">
|
|
|
|
<Setter Property="Margin" Value="0" />
|
2023-07-26 16:42:17 +08:00
|
|
|
<Setter Property="Width" Value="8" />
|
|
|
|
<Setter Property="Height" Value="8" />
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TreeDataGridColumnHeaderForeground}" />
|
2023-07-25 23:15:55 +08:00
|
|
|
<Setter Property="Template">
|
|
|
|
<ControlTemplate>
|
|
|
|
<Border
|
|
|
|
Width="{TemplateBinding Width}"
|
|
|
|
Height="{TemplateBinding Height}"
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
Background="Transparent">
|
2023-07-26 16:42:17 +08:00
|
|
|
<PathIcon
|
2024-11-07 17:56:29 +08:00
|
|
|
Name="ChevronPath"
|
2023-07-25 23:15:55 +08:00
|
|
|
HorizontalAlignment="Center"
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
Data="{DynamicResource TreeDataGridItemCollapsedChevronPathData}"
|
2023-07-26 16:42:17 +08:00
|
|
|
Foreground="{TemplateBinding Foreground}" />
|
2023-07-25 23:15:55 +08:00
|
|
|
</Border>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter>
|
2023-07-26 16:42:17 +08:00
|
|
|
<Style Selector="^:checked /template/ PathIcon#ChevronPath">
|
2023-10-10 00:35:53 +08:00
|
|
|
<Setter Property="RenderTransform" Value="rotate(90deg)" />
|
2023-07-25 23:15:55 +08:00
|
|
|
</Style>
|
|
|
|
</ControlTheme>
|
|
|
|
|
|
|
|
<ControlTheme x:Key="{x:Type TreeDataGridExpanderCell}" TargetType="TreeDataGridExpanderCell">
|
|
|
|
<Setter Property="Template">
|
|
|
|
<ControlTemplate>
|
|
|
|
<Border
|
2024-11-07 17:56:29 +08:00
|
|
|
Name="CellBorder"
|
2023-07-25 23:15:55 +08:00
|
|
|
Padding="{TemplateBinding Indent,
|
|
|
|
Converter={x:Static conv:IndentConverter.Instance}}"
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
CornerRadius="{TemplateBinding CornerRadius}">
|
|
|
|
<DockPanel>
|
|
|
|
<Border
|
|
|
|
Width="12"
|
|
|
|
Height="12"
|
|
|
|
Margin="4,0"
|
|
|
|
DockPanel.Dock="Left">
|
|
|
|
<ToggleButton
|
|
|
|
Focusable="False"
|
2024-07-15 22:36:55 +08:00
|
|
|
IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}"
|
2023-07-25 23:15:55 +08:00
|
|
|
IsVisible="{TemplateBinding ShowExpander}"
|
|
|
|
Theme="{StaticResource TreeDataGridExpandCollapseChevron}" />
|
|
|
|
</Border>
|
|
|
|
<Decorator Name="PART_Content" />
|
|
|
|
</DockPanel>
|
|
|
|
</Border>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter>
|
|
|
|
</ControlTheme>
|
|
|
|
|
|
|
|
<ControlTheme x:Key="{x:Type TreeDataGridTextCell}" TargetType="TreeDataGridTextCell">
|
2023-07-26 02:50:01 +08:00
|
|
|
<Setter Property="Padding" Value="8 4" />
|
2023-07-25 23:15:55 +08:00
|
|
|
<Setter Property="Template">
|
|
|
|
<ControlTemplate>
|
|
|
|
<Border
|
2024-11-07 17:56:29 +08:00
|
|
|
Name="CellBorder"
|
2023-07-25 23:15:55 +08:00
|
|
|
Padding="{TemplateBinding Padding}"
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
CornerRadius="{TemplateBinding CornerRadius}">
|
|
|
|
<TextBlock
|
2023-07-26 16:42:17 +08:00
|
|
|
HorizontalAlignment="Stretch"
|
2023-07-25 23:15:55 +08:00
|
|
|
VerticalAlignment="Center"
|
2023-07-26 16:42:17 +08:00
|
|
|
Background="Transparent"
|
2023-07-25 23:15:55 +08:00
|
|
|
Text="{TemplateBinding Value}"
|
|
|
|
TextTrimming="{TemplateBinding TextTrimming}"
|
|
|
|
TextWrapping="{TemplateBinding TextWrapping}" />
|
|
|
|
</Border>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter>
|
|
|
|
|
|
|
|
<Style Selector="^:editing">
|
|
|
|
<Setter Property="Padding" Value="4 2" />
|
|
|
|
<Setter Property="Template">
|
|
|
|
<ControlTemplate>
|
|
|
|
<Border
|
2024-11-07 17:56:29 +08:00
|
|
|
Name="CellBorder"
|
2023-07-25 23:15:55 +08:00
|
|
|
Padding="{TemplateBinding Padding}"
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
CornerRadius="{TemplateBinding CornerRadius}">
|
2023-07-26 02:50:01 +08:00
|
|
|
<TextBox
|
|
|
|
Name="PART_Edit"
|
|
|
|
Classes="Small"
|
2024-07-15 22:36:55 +08:00
|
|
|
Text="{TemplateBinding Value, Mode=TwoWay}" />
|
2023-07-25 23:15:55 +08:00
|
|
|
</Border>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter>
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
<Style Selector="^:editing /template/ TextBox#PART_Edit">
|
|
|
|
<Setter Property="Background" Value="Transparent" />
|
|
|
|
<Setter Property="MinHeight" Value="25" />
|
|
|
|
<Setter Property="Padding" Value="10,3,6,3" />
|
|
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
<Style Selector="^:editing /template/ TextBox#PART_Edit DataValidationErrors">
|
2023-07-26 02:50:01 +08:00
|
|
|
<Setter Property="Theme" Value="{DynamicResource TooltipDataValidationErrors}" />
|
2023-07-25 23:15:55 +08:00
|
|
|
</Style>
|
|
|
|
|
|
|
|
</ControlTheme>
|
|
|
|
|
|
|
|
<ControlTheme x:Key="{x:Type TreeDataGridTemplateCell}" TargetType="TreeDataGridTemplateCell">
|
|
|
|
<Setter Property="Template">
|
|
|
|
<ControlTemplate>
|
|
|
|
<ContentPresenter
|
|
|
|
Name="PART_ContentPresenter"
|
|
|
|
Padding="{TemplateBinding Padding}"
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
Content="{TemplateBinding Content}"
|
|
|
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
|
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter>
|
|
|
|
|
|
|
|
<Style Selector="^:editing">
|
|
|
|
<Setter Property="Padding" Value="4 2" />
|
|
|
|
<Setter Property="Template">
|
|
|
|
<ControlTemplate>
|
|
|
|
<ContentPresenter
|
|
|
|
Name="PART_EditingContentPresenter"
|
|
|
|
Padding="{TemplateBinding Padding}"
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
Content="{TemplateBinding Content}"
|
|
|
|
ContentTemplate="{TemplateBinding EditingTemplate}"
|
|
|
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter>
|
|
|
|
</Style>
|
|
|
|
</ControlTheme>
|
|
|
|
</ResourceDictionary>
|