From 1afe548ac40cc7f975917ef9bf2e156595cf81f3 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期四, 16 四月 2026 08:58:04 +0800
Subject: [PATCH] 优化;

---
 HMI.UI/Style/PanuonDataGrid.xaml |   95 ++++++++++++++++++++++++-----------------------
 1 files changed, 48 insertions(+), 47 deletions(-)

diff --git a/HMI.UI/Style/PanuonDataGrid.xaml b/HMI.UI/Style/PanuonDataGrid.xaml
index c2d9930..8e6858f 100644
--- a/HMI.UI/Style/PanuonDataGrid.xaml
+++ b/HMI.UI/Style/PanuonDataGrid.xaml
@@ -11,53 +11,71 @@
              xmlns:uic="clr-namespace:HMI.UI.Converter;assembly=HMI.UI"
              xmlns:dp="clr-namespace:HMI.UI.DpUtil;assembly=HMI.UI">
     <ResourceDictionary.MergedDictionaries>
-        <pu:StyleDictionary Includes="DataGrid" />
-        <ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/>
         <ResourceDictionary Source="/HMI.UI;component/Resources/Font/Font.xaml"/>
+        <ResourceDictionary Source="/HMI.UI;component/Style/ScrollBarResource.xaml"/>
     </ResourceDictionary.MergedDictionaries>
 
-    <Style x:Key="DefaultDataGridRow" TargetType="DataGridRow" BasedOn="{StaticResource {x:Static pu:StyleKeys.DataGridRowStyle}}">
-        <Setter Property="Background" Value="White"/>
-        <Setter Property="HeaderStyle">
+    <Style x:Key="DefaultDataGridColumnHeader" TargetType="DataGridColumnHeader">
+        <Setter Property="Background" Value="{DynamicResource PrimaryColor}"/>
+        <Setter Property="Foreground" Value="{DynamicResource PrimaryColorContract}"/>
+        <Setter Property="BorderBrush" Value="{DynamicResource PrimaryColorContract}"/>
+        <Setter Property="BorderThickness" Value="0,0,1,1"/>
+    </Style>
+
+    <Style x:Key="DefaultDataGridCell" TargetType="DataGridCell">
+        <Setter Property="Background" Value="Transparent"/>
+        <Setter Property="Padding" Value="5,0,0,0"/>
+        <Setter Property="Margin" Value="0"/>
+        <Setter Property="BorderThickness" Value="0"/>
+        <Setter Property="VerticalAlignment" Value="Stretch"/>
+        <Setter Property="VerticalContentAlignment" Value="Center"/>
+        <Setter Property="Template">
             <Setter.Value>
-                <Style TargetType="DataGridColumnHeader" 
-       BasedOn="{StaticResource {x:Static pu:StyleKeys.DataGridColumnHeaderStyle}}">
-                    <Setter Property="Padding" Value="10"/>
-                    <Setter Property="BorderThickness" Value="0"/>
-                </Style>
+                <ControlTemplate TargetType="DataGridCell">
+                    <Grid Background="{TemplateBinding Background}">
+                        <ContentPresenter VerticalAlignment="Center"/>
+                    </Grid>
+                </ControlTemplate>
             </Setter.Value>
         </Setter>
         <Style.Triggers>
-            <Trigger Property="AlternationIndex" Value="1">
-                <Setter Property="Background" Value="#eeeeee"/>
+            <Trigger Property="IsSelected" Value="True">
+                <Setter Property="Background" Value="{DynamicResource PrimaryColor}"/>
+                <Setter Property="Foreground" Value="{DynamicResource PrimaryColorContract}"/>
             </Trigger>
         </Style.Triggers>
     </Style>
 
-    <Style x:Key="DefaultDataGrid" TargetType="DataGrid" BasedOn="{StaticResource {x:Static pu:StyleKeys.DataGridStyle}}">
+    <Style x:Key="DefaultDataGridRow" TargetType="DataGridRow">
+        <Setter Property="Background" Value="White"/>
+        <Style.Triggers>
+            <Trigger Property="AlternationIndex" Value="1">
+                <Setter Property="Background" Value="#eeeeee"/>
+            </Trigger>
+            <Trigger Property="IsMouseOver" Value="True">
+                <Setter Property="Background" Value="{DynamicResource SecondPrimaryColor}"/>
+                <Setter Property="Foreground" Value="{DynamicResource SecondPrimaryColorContract}"/>
+            </Trigger>
+        </Style.Triggers>
+    </Style>
+
+    <Style x:Key="DefaultDataGrid" TargetType="DataGrid">
         <Style.Resources>
-            <Style TargetType="DataGridCell" 
-                   BasedOn="{StaticResource {x:Static pu:StyleKeys.DataGridCellStyle}}">
-                <Setter Property="Background" Value="Transparent"/>
-                <Setter Property="Padding" Value="5"/>
-                <Setter Property="Margin" Value="0"/>
-                <Setter Property="BorderThickness" Value="0"/>
-                <Setter Property="VerticalAlignment" Value="Stretch"/>
-            </Style>
+            <Style TargetType="ScrollBar" BasedOn="{StaticResource ScrollStyle_Mobile}"/>
         </Style.Resources>
+        <Setter Property="CellStyle" Value="{StaticResource DefaultDataGridCell}"/>
 
         <Setter Property="RowHeight" Value="30"/>
         <Setter Property="ColumnHeaderHeight" Value="36"/>
+        <Setter Property="ColumnHeaderStyle" Value="{StaticResource DefaultDataGridColumnHeader}"/>
 
-        <Setter Property="pu:DataGridHelper.ColumnHeaderPadding" Value="0"/>
         <Setter Property="ForceCursor" Value="True"/>
         <Setter Property="SelectionMode" Value="Single"/>
-        <!--<Setter Property="RowStyle" Value="{StaticResource DefaultDataGridRow}"/>-->
-        <Setter Property="AlternationCount" Value="2"></Setter>
-        <Setter Property="Foreground" Value="#3a3a3a"/>
-        <Setter Property="HorizontalGridLinesBrush" Value="{StaticResource TableBoarder}"/>
-        <Setter Property="VerticalGridLinesBrush" Value="{StaticResource TableBoarder}"/>
-        <Setter Property="BorderBrush" Value="{StaticResource TableBoarder}" />
+        <Setter Property="RowStyle" Value="{StaticResource DefaultDataGridRow}"/>
+        <Setter Property="AlternationCount" Value="2"/>
+        <Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource TableBoarder}"/>
+        <Setter Property="VerticalGridLinesBrush" Value="{DynamicResource TableBoarder}"/>
+        <Setter Property="BorderBrush" Value="{DynamicResource TableBoarder}" />
         <Setter Property="AutoGenerateColumns" Value="False"/>
         <Setter Property="CanUserAddRows" Value="False"/>
         <Setter Property="CanUserSortColumns" Value="False"/>
@@ -66,24 +84,7 @@
         <Setter Property="IsReadOnly" Value="True"/>
         <Setter Property="GridLinesVisibility" Value="All"/>
         <Setter Property="BorderThickness" Value="0"/>
-        <Setter Property="BorderBrush" Value="{StaticResource CommonBoarder}"/>
-        <Setter Property="FontSize" Value="{StaticResource ContentFontSize2}"/>
-        <Setter Property="pu:DataGridHelper.IsVerticalScrollBarCrossingColumnHeaderPanel" Value="True"/>
-        <Setter Property="pu:DataGridHelper.ColumnHeaderForeground" Value="White"/>
-        <Setter Property="pu:DataGridHelper.ColumnHeaderBackground" Value="{StaticResource TableHeader}"/>
-        <Setter Property="pu:DataGridHelper.ColumnHeaderHoverBackground" Value="{StaticResource TableHeader}"/>
-        <Setter Property="pu:DataGridHelper.ColumnHeaderSeparatorBrush" Value="{StaticResource TableBoarder}"/>
-        <Setter Property="pu:DataGridHelper.ColumnHeaderSeparatorVisibility" Value="Visible"/>
-        <Setter Property="pu:DataGridHelper.ColumnHeaderVerticalContentAlignment" Value="Center"/>
-        <Setter Property="pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment" Value="Left"/>
-
-        <Setter Property="pu:DataGridHelper.RowHeaderSeparatorBrush" Value="{StaticResource CommonBoarder}"/>
-        <Setter Property="pu:DataGridHelper.RowHoverForeground" Value="{StaticResource SecondPrimaryColorContract}"/>
-        <Setter Property="pu:DataGridHelper.RowHoverBackground" Value="{StaticResource SecondPrimaryColor}"/>
-        <Setter Property="pu:DataGridHelper.RowSelectedBackground" Value="{StaticResource PrimaryColor}"/>
-        <Setter Property="pu:DataGridHelper.RowSelectedForeground" Value="White"/>
-        <Setter Property="pu:DataGridHelper.RowHeaderBorderThickness" Value="10,0,0,0"/>
-        <Setter Property="pu:DataGridHelper.ColumnHeaderBorderThickness" Value="0"/>
-        <Setter Property="pu:DataGridHelper.ColumnHeaderPadding" Value="0"/>
+        <Setter Property="BorderBrush" Value="{DynamicResource CommonBoarder}"/>
+        <Setter Property="FontSize" Value="{DynamicResource ContentFontSize2}"/>
     </Style>
 </ResourceDictionary>
\ No newline at end of file

--
Gitblit v1.9.1