2025-07-31 20:12:01 +08:00
|
|
|
|
<ResourceDictionary
|
|
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
2026-01-02 17:30:41 +08:00
|
|
|
|
xmlns:assists="clr-namespace:Melskin.Assists"
|
|
|
|
|
|
xmlns:controls="clr-namespace:Melskin.Controls"
|
|
|
|
|
|
xmlns:converters="clr-namespace:Melskin.Converters"
|
|
|
|
|
|
xmlns:decorations="clr-namespace:Melskin.Controls.Decorations"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<!-- 将 DataGrid 自己通过 DataContext 传给代理 -->
|
|
|
|
|
|
<!--<assists:BindingProxy x:Key="DataGridProxy" Data="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" />-->
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 勾选框样式 -->
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Style TargetType="{x:Type CheckBox}" x:Key="DataGridCheckBoxStyle">
|
2025-08-26 21:33:20 +08:00
|
|
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
|
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
|
|
|
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
|
|
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
|
|
|
|
<Setter Property="FontSize" Value="14" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type CheckBox}">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Border
|
2025-07-11 09:20:23 +08:00
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
CornerRadius="4"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Height="18"
|
|
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
|
|
Margin="4,2"
|
|
|
|
|
|
RenderTransformOrigin="0.5,0.5"
|
|
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
|
Width="18"
|
|
|
|
|
|
x:Name="checkBoxBorder">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Grid Margin="-1">
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<controls:IconElement
|
|
|
|
|
|
Foreground="{TemplateBinding Foreground}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Margin="3"
|
2025-09-08 19:49:09 +08:00
|
|
|
|
Symbol="Check"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Visibility="Hidden"
|
|
|
|
|
|
x:Name="checkMark" />
|
2025-09-08 19:49:09 +08:00
|
|
|
|
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Rectangle
|
2025-08-24 13:49:55 +08:00
|
|
|
|
Fill="{TemplateBinding Foreground}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Margin="3"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
RadiusX="3"
|
|
|
|
|
|
RadiusY="3"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Visibility="Hidden"
|
|
|
|
|
|
x:Name="indeterminateMark" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
</Border>
|
|
|
|
|
|
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
2025-07-31 20:12:24 +08:00
|
|
|
|
<Trigger Property="HasContent" Value="True" />
|
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="{DynamicResource PrimaryFocusedBrush}" />
|
|
|
|
|
|
<Setter Property="Fill" TargetName="indeterminateMark" Value="{DynamicResource PrimaryFocusedBrush}" />
|
|
|
|
|
|
<Setter Property="Foreground" TargetName="checkMark" Value="{DynamicResource PrimaryFocusedBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="{DynamicResource TextDisabledBrush}" />
|
|
|
|
|
|
<Setter Property="Background" TargetName="checkBoxBorder" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
|
|
|
|
|
<Setter Property="Fill" TargetName="indeterminateMark" Value="{DynamicResource TextDisabledBrush}" />
|
|
|
|
|
|
<Setter Property="Foreground" TargetName="checkMark" Value="{DynamicResource TextDisabledBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-07-31 20:12:24 +08:00
|
|
|
|
<Trigger Property="IsPressed" Value="True">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="RenderTransform" TargetName="checkBoxBorder">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter.Value>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ScaleTransform ScaleX="0.9" ScaleY="0.9" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Trigger>
|
2025-07-31 20:12:24 +08:00
|
|
|
|
<Trigger Property="IsChecked" Value="True">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Visibility" TargetName="checkMark" Value="Visible" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<Trigger Property="IsChecked" Value="{x:Null}">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Visibility" TargetName="indeterminateMark" Value="Visible" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Style>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 格子内容 -->
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Style TargetType="{x:Type DataGridCell}" x:Key="DefaultDataGridCellStyle">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="Background" Value="Transparent" />
|
|
|
|
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<!--<Setter Property="Padding" Value="8,4"/>-->
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
|
|
|
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
|
|
|
|
|
<Setter Property="BorderThickness" Value="0" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type DataGridCell}">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Border
|
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Padding="{TemplateBinding Padding}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
SnapsToDevicePixels="True">
|
|
|
|
|
|
<ContentPresenter
|
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
x:Name="content" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Border>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
<Style.Triggers>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 某行被选中的效果,由Row控制 -->
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Trigger Property="IsSelected" Value="True">
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 某一格被选中的效果 -->
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Trigger Property="IsKeyboardFocusWithin" Value="True">
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 选中但窗口没激活,由Row控制 -->
|
2025-08-24 13:49:55 +08:00
|
|
|
|
<MultiTrigger>
|
|
|
|
|
|
<MultiTrigger.Conditions>
|
|
|
|
|
|
<Condition Property="IsSelected" Value="True" />
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Condition Property="Selector.IsSelectionActive" Value="False" />
|
2025-08-24 13:49:55 +08:00
|
|
|
|
</MultiTrigger.Conditions>
|
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
|
|
|
|
</MultiTrigger>
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
|
</Style>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 表头分割区域 -->
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Style TargetType="{x:Type Thumb}" x:Key="DefaultColumnHeaderGripperStyle">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="Width" Value="8" />
|
|
|
|
|
|
<Setter Property="Background" Value="Transparent" />
|
|
|
|
|
|
<Setter Property="Cursor" Value="SizeWE" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type Thumb}">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Style>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 表头样式 -->
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Style TargetType="{x:Type DataGridColumnHeader}" x:Key="DefaultDataGridColumnHeaderStyle">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="Padding" Value="8,4" />
|
|
|
|
|
|
<Setter Property="Background" Value="Transparent" />
|
|
|
|
|
|
<Setter Property="SeparatorVisibility" Value="Visible" />
|
2025-08-20 12:10:35 +08:00
|
|
|
|
<Setter Property="SeparatorBrush" Value="{DynamicResource BorderNormalBrush}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
|
|
|
|
|
|
<Grid>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- TODO: IsClickable="{TemplateBinding CanUserSort}" -->
|
|
|
|
|
|
<Border
|
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
Padding="{TemplateBinding Padding}">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Grid>
|
|
|
|
|
|
<Grid.ColumnDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
|
<ColumnDefinition Width="auto" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid.ColumnDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ContentPresenter
|
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
|
|
RecognizesAccessKey="True"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Path
|
|
|
|
|
|
Grid.Column="1"
|
2025-08-24 13:49:55 +08:00
|
|
|
|
HorizontalAlignment="Center"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Margin="4,0,0,0"
|
2025-10-10 11:19:58 +08:00
|
|
|
|
SnapsToDevicePixels="False"
|
2025-08-25 17:30:53 +08:00
|
|
|
|
Stroke="{DynamicResource TextSecondaryBrush}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
StrokeThickness="2"
|
|
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
|
x:Name="sortMark" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
|
|
</Border>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Border
|
|
|
|
|
|
Background="{TemplateBinding SeparatorBrush}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
HorizontalAlignment="Right"
|
|
|
|
|
|
Visibility="{TemplateBinding SeparatorVisibility}"
|
|
|
|
|
|
Width="1"
|
|
|
|
|
|
x:Name="separatorV" />
|
2025-08-24 13:49:55 +08:00
|
|
|
|
<Border
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Background="{TemplateBinding SeparatorBrush}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Height="1"
|
|
|
|
|
|
VerticalAlignment="Bottom"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Visibility="{TemplateBinding SeparatorVisibility}"
|
|
|
|
|
|
x:Name="separatorH" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Thumb
|
|
|
|
|
|
HorizontalAlignment="Left"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Style="{StaticResource DefaultColumnHeaderGripperStyle}"
|
|
|
|
|
|
x:Name="PART_LeftHeaderGripper" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Thumb
|
|
|
|
|
|
HorizontalAlignment="Right"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Style="{StaticResource DefaultColumnHeaderGripperStyle}"
|
|
|
|
|
|
x:Name="PART_RightHeaderGripper" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
|
<MultiTrigger>
|
|
|
|
|
|
<MultiTrigger.Conditions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Condition Property="IsPressed" Value="False" />
|
|
|
|
|
|
<Condition Property="IsMouseOver" Value="True" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</MultiTrigger.Conditions>
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</MultiTrigger>
|
|
|
|
|
|
<Trigger Property="IsPressed" Value="True">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Visibility" TargetName="separatorV" Value="Hidden" />
|
|
|
|
|
|
<Setter Property="Visibility" TargetName="separatorH" Value="Hidden" />
|
2025-08-25 17:30:53 +08:00
|
|
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundPressedBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 排序方式 -->
|
|
|
|
|
|
<DataTrigger Binding="{Binding SortDirection, RelativeSource={RelativeSource Mode=Self}}" Value="Ascending">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Data" TargetName="sortMark" Value="M 1,4.5 L 4.5,1 L 8,4.5" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</DataTrigger>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<DataTrigger Binding="{Binding SortDirection, RelativeSource={RelativeSource Mode=Self}}" Value="Descending">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Data" TargetName="sortMark" Value="M 1,1.5 L 4.5,5 L 8,1.5" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</DataTrigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Style>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 目标位置预览 -->
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Style x:Key="DefaultDataGridDropLocationIndicatorStyle">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter Property="Control.Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Border
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Background="{DynamicResource PrimaryNormalBrush}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Margin="-1,0,0,0"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Width="4" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Style>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 行开头分割区域 -->
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Style TargetType="{x:Type Thumb}" x:Key="DefaultRowHeaderGripperStyle">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="Height" Value="8" />
|
|
|
|
|
|
<Setter Property="Background" Value="Transparent" />
|
|
|
|
|
|
<Setter Property="Cursor" Value="SizeNS" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type Thumb}">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Style>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 行开头样式 -->
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Style TargetType="{x:Type DataGridRowHeader}" x:Key="DefaultDataGridRowHeaderStyle">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="MinWidth" Value="16" />
|
|
|
|
|
|
<Setter Property="Padding" Value="4,0" />
|
|
|
|
|
|
<Setter Property="SeparatorVisibility" Value="Visible" />
|
2025-08-20 12:10:35 +08:00
|
|
|
|
<Setter Property="SeparatorBrush" Value="{DynamicResource BorderNormalBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type DataGridRowHeader}">
|
|
|
|
|
|
<Grid>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Border
|
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
Padding="{TemplateBinding Padding}">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<StackPanel Orientation="Horizontal">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ContentPresenter
|
|
|
|
|
|
RecognizesAccessKey="True"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
|
|
|
|
|
VerticalAlignment="Center" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Control
|
2025-10-10 11:19:58 +08:00
|
|
|
|
SnapsToDevicePixels="False"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Template="{Binding ValidationErrorTemplate, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"
|
2025-08-20 12:10:35 +08:00
|
|
|
|
Visibility="{Binding (Validation.HasError), Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</StackPanel>
|
|
|
|
|
|
</Border>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Border
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Background="{TemplateBinding SeparatorBrush}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Height="1"
|
|
|
|
|
|
VerticalAlignment="Bottom"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Visibility="{TemplateBinding SeparatorVisibility}"
|
|
|
|
|
|
x:Name="separatorBorder" />
|
2025-08-24 13:49:55 +08:00
|
|
|
|
<Border
|
|
|
|
|
|
Background="{TemplateBinding SeparatorBrush}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
HorizontalAlignment="Right"
|
|
|
|
|
|
Visibility="{TemplateBinding SeparatorVisibility}"
|
|
|
|
|
|
Width="1"
|
|
|
|
|
|
x:Name="separatorVertical" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Thumb
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Style="{StaticResource DefaultRowHeaderGripperStyle}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
VerticalAlignment="Top"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
x:Name="PART_TopHeaderGripper" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Thumb
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Style="{StaticResource DefaultRowHeaderGripperStyle}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
VerticalAlignment="Bottom"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
x:Name="PART_BottomHeaderGripper" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Style>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 整行样式 -->
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Style TargetType="{x:Type DataGridRow}" x:Key="DefaultDataGridRowStyle">
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
2025-07-31 20:12:24 +08:00
|
|
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter Property="ValidationErrorTemplate">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<TextBlock
|
|
|
|
|
|
FontSize="14"
|
|
|
|
|
|
FontWeight="Bold"
|
2025-08-12 23:08:54 +08:00
|
|
|
|
Foreground="{DynamicResource ErrorBrush}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Margin="2,0,0,0"
|
|
|
|
|
|
Text="!"
|
|
|
|
|
|
VerticalAlignment="Center" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type DataGridRow}">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Border
|
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
SnapsToDevicePixels="True"
|
|
|
|
|
|
x:Name="DGR_Border">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<SelectiveScrollingGrid>
|
|
|
|
|
|
<SelectiveScrollingGrid.ColumnDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
|
<ColumnDefinition Width="*" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</SelectiveScrollingGrid.ColumnDefinitions>
|
|
|
|
|
|
<SelectiveScrollingGrid.RowDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<RowDefinition Height="*" />
|
|
|
|
|
|
<RowDefinition Height="Auto" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</SelectiveScrollingGrid.RowDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<DataGridCellsPresenter
|
|
|
|
|
|
Grid.Column="1"
|
|
|
|
|
|
ItemsPanel="{TemplateBinding ItemsPanel}"
|
|
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<!-- 绑定失败 -->
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<DataGridDetailsPresenter
|
2025-08-24 13:49:55 +08:00
|
|
|
|
Grid.Column="1"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Grid.Row="1"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding AreRowDetailsFrozen, ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}, Converter={x:Static DataGrid.RowDetailsScrollingConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, FallbackValue=None}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Visibility="{TemplateBinding DetailsVisibility}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<!-- 绑定失败 -->
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<DataGridRowHeader
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Grid.Column="0"
|
2025-07-31 20:12:24 +08:00
|
|
|
|
Grid.Row="0"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Grid.RowSpan="2"
|
|
|
|
|
|
SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
|
2025-12-23 21:35:54 +08:00
|
|
|
|
Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Row}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, FallbackValue=Visible}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</SelectiveScrollingGrid>
|
|
|
|
|
|
</Border>
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
|
<Trigger Property="IsSelected" Value="True">
|
2025-10-04 08:52:23 +08:00
|
|
|
|
<Setter Property="Background" Value="{DynamicResource PrimaryFocusedBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 选中但窗口没激活 -->
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<MultiTrigger>
|
|
|
|
|
|
<MultiTrigger.Conditions>
|
2025-07-31 20:12:24 +08:00
|
|
|
|
<Condition Property="IsSelected" Value="True" />
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Condition Property="Selector.IsSelectionActive" Value="False" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</MultiTrigger.Conditions>
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</MultiTrigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<!-- 绑定失败 -->
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Style.Triggers>
|
|
|
|
|
|
<Trigger Property="IsNewItem" Value="True">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Setter Property="Margin" Value="{Binding NewItemMargin, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, FallbackValue=0}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
|
</Style>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 网格全选按钮 -->
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Style TargetType="{x:Type Button}" x:Key="{ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type Button}">
|
|
|
|
|
|
<Grid>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Rectangle
|
|
|
|
|
|
Fill="Transparent"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
SnapsToDevicePixels="True"
|
|
|
|
|
|
x:Name="Border" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Border
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Background="{DynamicResource BorderNormalBrush}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
HorizontalAlignment="Right"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Width="1" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Border
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Background="{DynamicResource BorderNormalBrush}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Height="1"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
VerticalAlignment="Bottom" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Polygon
|
2025-08-25 17:30:53 +08:00
|
|
|
|
Fill="{DynamicResource ControlBackgroundSelectedBrush}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
HorizontalAlignment="Right"
|
|
|
|
|
|
Margin="8,8,3,3"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Opacity="0.15"
|
|
|
|
|
|
Points="0,10 10,10 10,0"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Stretch="Uniform"
|
|
|
|
|
|
VerticalAlignment="Bottom"
|
|
|
|
|
|
x:Name="Arrow" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Fill" TargetName="Border" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
|
|
|
|
|
<Setter Property="Fill" TargetName="Arrow" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<Trigger Property="IsPressed" Value="True">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Fill" TargetName="Border" Value="{DynamicResource BackgroundFloatingBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Visibility" TargetName="Arrow" Value="Collapsed" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Trigger>
|
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
</Style>
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Style TargetType="{x:Type DataGrid}" x:Key="DefaultDataGridStyle">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Setter Property="RowStyle" Value="{DynamicResource DefaultDataGridRowStyle}" />
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Setter Property="CellStyle" Value="{StaticResource DefaultDataGridCellStyle}" />
|
|
|
|
|
|
<Setter Property="ColumnHeaderStyle" Value="{StaticResource DefaultDataGridColumnHeaderStyle}" />
|
|
|
|
|
|
<Setter Property="DropLocationIndicatorStyle" Value="{StaticResource DefaultDataGridDropLocationIndicatorStyle}" />
|
|
|
|
|
|
<Setter Property="RowHeaderStyle" Value="{StaticResource DefaultDataGridRowHeaderStyle}" />
|
2025-08-24 13:49:55 +08:00
|
|
|
|
<Setter Property="Background" Value="{DynamicResource BackgroundLayoutBrush}" />
|
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
|
|
|
|
<Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource BorderNormalBrush}" />
|
|
|
|
|
|
<Setter Property="VerticalGridLinesBrush" Value="{DynamicResource BorderNormalBrush}" />
|
|
|
|
|
|
<Setter Property="FontSize" Value="14" />
|
|
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
|
|
|
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
|
|
|
|
<Setter Property="RowDetailsVisibilityMode" Value="VisibleWhenSelected" />
|
|
|
|
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
|
|
|
|
|
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
|
|
|
|
|
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
|
|
|
|
|
<Setter Property="assists:DataGridAssist.TextColumnStyle">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<Style TargetType="TextBlock">
|
|
|
|
|
|
<Setter Property="Padding" Value="4,2" />
|
|
|
|
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
|
|
|
|
</Style>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Setter Property="assists:DataGridAssist.EditingTextColumnStyle" Value="{DynamicResource FlattenTextBoxStyle}" />
|
|
|
|
|
|
<Setter Property="assists:DataGridAssist.CheckBoxColumnStyle" Value="{StaticResource DataGridCheckBoxStyle}" />
|
|
|
|
|
|
<Setter Property="assists:DataGridAssist.EditingCheckBoxColumnStyle" Value="{StaticResource DataGridCheckBoxStyle}" />
|
|
|
|
|
|
<Setter Property="assists:DataGridAssist.ComboBoxColumnStyle" Value="{DynamicResource ComboBoxPreviewStyle}" />
|
|
|
|
|
|
<Setter Property="assists:DataGridAssist.EditingComboBoxColumnStyle" Value="{DynamicResource FlattenComboBoxStyle}" />
|
2025-08-24 13:49:55 +08:00
|
|
|
|
<Setter Property="assists:DataGridAssist.ApplyDefaultStyle" Value="True" />
|
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type DataGrid}">
|
|
|
|
|
|
<Border
|
2025-09-08 19:49:09 +08:00
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
CornerRadius="4"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Padding="{TemplateBinding Padding}"
|
2025-09-08 19:49:09 +08:00
|
|
|
|
SnapsToDevicePixels="True">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<ScrollViewer Focusable="False" x:Name="DG_ScrollViewer">
|
2025-08-24 13:49:55 +08:00
|
|
|
|
<ScrollViewer.Template>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type ScrollViewer}">
|
|
|
|
|
|
<Grid>
|
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
|
<RowDefinition Height="*" />
|
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
|
<Button
|
2025-09-08 19:49:09 +08:00
|
|
|
|
Command="{x:Static DataGrid.SelectAllCommand}"
|
2025-10-10 11:19:58 +08:00
|
|
|
|
Focusable="False"
|
2025-09-08 19:49:09 +08:00
|
|
|
|
Style="{DynamicResource {ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle,
|
|
|
|
|
|
TypeInTargetAssembly={x:Type DataGrid}}}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
|
|
|
|
|
|
Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
|
2025-08-24 13:49:55 +08:00
|
|
|
|
<DataGridColumnHeadersPresenter
|
2025-09-08 19:49:09 +08:00
|
|
|
|
Grid.Column="1"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Grid.Row="0"
|
|
|
|
|
|
Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Column}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
|
|
|
|
|
|
x:Name="PART_ColumnHeadersPresenter" />
|
2025-08-24 13:49:55 +08:00
|
|
|
|
<ScrollContentPresenter
|
2026-01-02 17:30:30 +08:00
|
|
|
|
CanContentScroll="{TemplateBinding CanContentScroll}"
|
2025-09-08 19:49:09 +08:00
|
|
|
|
Grid.Column="0"
|
|
|
|
|
|
Grid.ColumnSpan="2"
|
|
|
|
|
|
Grid.Row="1"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
x:Name="PART_ScrollContentPresenter" />
|
|
|
|
|
|
<ScrollBar
|
2025-09-08 19:49:09 +08:00
|
|
|
|
Grid.Column="2"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Grid.Row="1"
|
2025-09-08 19:49:09 +08:00
|
|
|
|
Maximum="{TemplateBinding ScrollableHeight}"
|
|
|
|
|
|
Orientation="Vertical"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
|
2025-09-08 19:49:09 +08:00
|
|
|
|
ViewportSize="{TemplateBinding ViewportHeight}"
|
|
|
|
|
|
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
x:Name="PART_VerticalScrollBar" />
|
|
|
|
|
|
<Grid Grid.Column="1" Grid.Row="2">
|
2025-08-24 13:49:55 +08:00
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
|
<ColumnDefinition Width="{Binding NonFrozenColumnsViewportHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
|
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
<ScrollBar
|
2025-09-08 19:49:09 +08:00
|
|
|
|
Grid.Column="1"
|
|
|
|
|
|
Maximum="{TemplateBinding ScrollableWidth}"
|
|
|
|
|
|
Orientation="Horizontal"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
|
2025-09-08 19:49:09 +08:00
|
|
|
|
ViewportSize="{TemplateBinding ViewportWidth}"
|
|
|
|
|
|
Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
x:Name="PART_HorizontalScrollBar" />
|
2025-08-24 13:49:55 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
</Grid>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</ScrollViewer.Template>
|
|
|
|
|
|
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
|
|
|
|
|
</ScrollViewer>
|
|
|
|
|
|
</Border>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
|
<MultiTrigger>
|
|
|
|
|
|
<MultiTrigger.Conditions>
|
|
|
|
|
|
<Condition Property="IsGrouping" Value="True" />
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="False" />
|
2025-08-24 13:49:55 +08:00
|
|
|
|
</MultiTrigger.Conditions>
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
|
2025-08-24 13:49:55 +08:00
|
|
|
|
</MultiTrigger>
|
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
|
</Style>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<!-- 整体数据网格样式 -->
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Style TargetType="{x:Type DataGrid}" x:Key="CheckBoxHeadDataGridStyle">
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Setter Property="RowStyle" Value="{StaticResource DefaultDataGridRowStyle}" />
|
|
|
|
|
|
<Setter Property="CellStyle" Value="{StaticResource DefaultDataGridCellStyle}" />
|
|
|
|
|
|
<Setter Property="ColumnHeaderStyle" Value="{StaticResource DefaultDataGridColumnHeaderStyle}" />
|
|
|
|
|
|
<Setter Property="DropLocationIndicatorStyle" Value="{StaticResource DefaultDataGridDropLocationIndicatorStyle}" />
|
|
|
|
|
|
<Setter Property="RowHeaderStyle" Value="{StaticResource DefaultDataGridRowHeaderStyle}" />
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="Background" Value="{DynamicResource BackgroundLayoutBrush}" />
|
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
2025-08-20 12:10:35 +08:00
|
|
|
|
<Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource BorderNormalBrush}" />
|
|
|
|
|
|
<Setter Property="VerticalGridLinesBrush" Value="{DynamicResource BorderNormalBrush}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="FontSize" Value="14" />
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
|
|
|
|
<Setter Property="RowDetailsVisibilityMode" Value="VisibleWhenSelected" />
|
2025-07-31 20:12:24 +08:00
|
|
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
|
|
|
|
|
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="assists:DataGridAssist.TextColumnStyle">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<Style TargetType="TextBlock">
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Setter Property="Padding" Value="4,2" />
|
|
|
|
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Style>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Setter Property="assists:DataGridAssist.EditingTextColumnStyle" Value="{DynamicResource FlattenTextBoxStyle}" />
|
|
|
|
|
|
<Setter Property="assists:DataGridAssist.CheckBoxColumnStyle" Value="{StaticResource DataGridCheckBoxStyle}" />
|
|
|
|
|
|
<Setter Property="assists:DataGridAssist.EditingCheckBoxColumnStyle" Value="{StaticResource DataGridCheckBoxStyle}" />
|
|
|
|
|
|
<Setter Property="assists:DataGridAssist.ComboBoxColumnStyle" Value="{DynamicResource ComboBoxPreviewStyle}" />
|
|
|
|
|
|
<Setter Property="assists:DataGridAssist.EditingComboBoxColumnStyle" Value="{DynamicResource FlattenComboBoxStyle}" />
|
2025-08-12 23:08:54 +08:00
|
|
|
|
<Setter Property="assists:DataGridAssist.ApplyDefaultStyle" Value="True" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Setter Property="RowHeaderTemplate">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<DataTemplate>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<CheckBox IsChecked="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=DataGridRow}}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</DataTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type DataGrid}">
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<decorations:EmbossBorder
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
|
|
|
|
CornerRadius="4"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Padding="{TemplateBinding Padding}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
SnapsToDevicePixels="True">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<ScrollViewer Focusable="False" x:Name="DG_ScrollViewer">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<ScrollViewer.Template>
|
|
|
|
|
|
<ControlTemplate TargetType="{x:Type ScrollViewer}">
|
|
|
|
|
|
<Grid>
|
|
|
|
|
|
<Grid.ColumnDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
<Grid.RowDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
|
<RowDefinition Height="*" />
|
|
|
|
|
|
<RowDefinition Height="Auto" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid.RowDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<Button
|
|
|
|
|
|
Command="{x:Static DataGrid.SelectAllCommand}"
|
2025-10-10 11:19:58 +08:00
|
|
|
|
Focusable="False"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Style="{DynamicResource {ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle,
|
|
|
|
|
|
TypeInTargetAssembly={x:Type DataGrid}}}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
|
|
|
|
|
|
Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<DataGridColumnHeadersPresenter
|
2025-08-24 13:49:55 +08:00
|
|
|
|
Grid.Column="1"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Grid.Row="0"
|
|
|
|
|
|
Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Column}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
|
|
|
|
|
|
x:Name="PART_ColumnHeadersPresenter" />
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ScrollContentPresenter
|
2026-01-02 17:30:30 +08:00
|
|
|
|
CanContentScroll="{TemplateBinding CanContentScroll}"
|
2025-07-31 20:12:24 +08:00
|
|
|
|
Grid.Column="0"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Grid.ColumnSpan="2"
|
|
|
|
|
|
Grid.Row="1"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
x:Name="PART_ScrollContentPresenter" />
|
|
|
|
|
|
<ScrollBar
|
2025-08-24 13:49:55 +08:00
|
|
|
|
Grid.Column="2"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Grid.Row="1"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
Maximum="{TemplateBinding ScrollableHeight}"
|
|
|
|
|
|
Orientation="Vertical"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
ViewportSize="{TemplateBinding ViewportHeight}"
|
|
|
|
|
|
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
x:Name="PART_VerticalScrollBar" />
|
|
|
|
|
|
<Grid Grid.Column="1" Grid.Row="2">
|
2025-07-11 09:20:23 +08:00
|
|
|
|
<Grid.ColumnDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ColumnDefinition Width="{Binding NonFrozenColumnsViewportHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
|
|
|
|
|
|
<ColumnDefinition Width="*" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid.ColumnDefinitions>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ScrollBar
|
|
|
|
|
|
Grid.Column="1"
|
|
|
|
|
|
Maximum="{TemplateBinding ScrollableWidth}"
|
|
|
|
|
|
Orientation="Horizontal"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
|
2025-07-31 20:12:01 +08:00
|
|
|
|
ViewportSize="{TemplateBinding ViewportWidth}"
|
|
|
|
|
|
Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
x:Name="PART_HorizontalScrollBar" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
</Grid>
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</ScrollViewer.Template>
|
2025-07-31 20:12:01 +08:00
|
|
|
|
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</ScrollViewer>
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</decorations:EmbossBorder>
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</ControlTemplate>
|
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
|
</Setter>
|
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
|
<MultiTrigger>
|
|
|
|
|
|
<MultiTrigger.Conditions>
|
2025-07-31 20:12:24 +08:00
|
|
|
|
<Condition Property="IsGrouping" Value="True" />
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="False" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</MultiTrigger.Conditions>
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</MultiTrigger>
|
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
|
</Style>
|
2025-08-24 13:49:55 +08:00
|
|
|
|
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Style BasedOn="{StaticResource DefaultDataGridStyle}" TargetType="DataGrid" />
|
2025-10-04 08:52:23 +08:00
|
|
|
|
|
2025-10-10 11:19:58 +08:00
|
|
|
|
<Style BasedOn="{StaticResource DefaultDataGridStyle}" TargetType="{x:Type controls:NeuDataGrid}">
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<Setter Property="CanUserAddRows" Value="False" />
|
2025-12-23 21:35:54 +08:00
|
|
|
|
<Setter Property="RowHeaderTemplate">
|
2025-08-24 13:49:55 +08:00
|
|
|
|
<Setter.Value>
|
|
|
|
|
|
<DataTemplate>
|
|
|
|
|
|
<Grid>
|
2025-12-23 21:35:54 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 默认显示行号的TextBlock -->
|
|
|
|
|
|
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<TextBlock
|
|
|
|
|
|
HorizontalAlignment="Center"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
Text="{Binding RelativeSource={RelativeSource AncestorType=DataGridRow}, Path=Header}"
|
|
|
|
|
|
VerticalAlignment="Center" />
|
2025-09-08 19:49:09 +08:00
|
|
|
|
|
2025-12-23 21:35:54 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 当有验证错误时,显示一个红色的感叹号 -->
|
|
|
|
|
|
|
2025-09-08 19:49:09 +08:00
|
|
|
|
<TextBlock
|
|
|
|
|
|
FontSize="16"
|
|
|
|
|
|
FontWeight="Bold"
|
|
|
|
|
|
Foreground="Red"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
HorizontalAlignment="Center"
|
2025-09-08 19:49:09 +08:00
|
|
|
|
Text="!"
|
|
|
|
|
|
ToolTip="{Binding RelativeSource={RelativeSource AncestorType=DataGridRow}, Path=(Validation.Errors).CurrentItem.ErrorContent}"
|
2026-01-02 17:30:30 +08:00
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
|
Visibility="Collapsed"
|
|
|
|
|
|
x:Name="ErrorIcon" />
|
2025-08-24 13:49:55 +08:00
|
|
|
|
</Grid>
|
|
|
|
|
|
<DataTemplate.Triggers>
|
2025-12-23 21:35:54 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 当行的Validation.HasError为True时,触发器会将感叹号显示出来 -->
|
|
|
|
|
|
|
2025-08-24 13:49:55 +08:00
|
|
|
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=DataGridRow}, Path=(Validation.HasError)}" Value="True">
|
2026-01-02 17:30:30 +08:00
|
|
|
|
<Setter Property="Visibility" TargetName="ErrorIcon" Value="Visible" />
|
2025-08-24 13:49:55 +08:00
|
|
|
|
</DataTrigger>
|
|
|
|
|
|
</DataTemplate.Triggers>
|
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
|
</Setter.Value>
|
2025-12-23 21:35:54 +08:00
|
|
|
|
</Setter>
|
2025-08-24 13:49:55 +08:00
|
|
|
|
</Style>
|
2025-07-11 09:20:23 +08:00
|
|
|
|
</ResourceDictionary>
|