From 15bbd62b0b24b72c717ae91ab45348a2083ad04e Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期五, 10 十月 2025 08:58:18 +0800
Subject: [PATCH] 优化bug;
---
HMI.UI/Style/PanuonResource.xaml | 124 ++++++++++++++++-------------------------
1 files changed, 48 insertions(+), 76 deletions(-)
diff --git a/HMI.UI/Style/PanuonResource.xaml b/HMI.UI/Style/PanuonResource.xaml
index 4fdbc63..23a2dcb 100644
--- a/HMI.UI/Style/PanuonResource.xaml
+++ b/HMI.UI/Style/PanuonResource.xaml
@@ -11,8 +11,10 @@
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="PasswordBox,TextBox,ComboBox,Button,TreeView,Menu,ListBox,ContextMenu,TabControl" />
<ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/>
- <pu:StyleDictionary Includes="PasswordBox,TextBox,ComboBox,Button,DataGrid,TreeView,Menu,ListBox" />
+ <ResourceDictionary Source="/HMI.UI;component/Style/PanuonDataGrid.xaml"/>
+ <ResourceDictionary Source="/HMI.UI;component/Style/ScrollBarResource.xaml"/>
<ResourceDictionary Source="/HMI.UI;component/Resources/Font/Font.xaml"/>
</ResourceDictionary.MergedDictionaries>
<sys:Double x:Key="TitleFontSize">20</sys:Double>
@@ -55,7 +57,7 @@
<Setter Property="pu:ButtonHelper.Icon" Value=""/>
<Setter Property="Content" Value="{DynamicResource App.Edit}"/>
</Style>
-
+
<Style x:Key="RfhBtn" TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
<Setter Property="pu:ButtonHelper.Icon" Value=""/>
<Setter Property="Content" Value="{DynamicResource App.Refresh}"/>
@@ -157,79 +159,15 @@
<Setter Property="BorderBrush" Value="{StaticResource CommonBoarder}"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="Background" Value="#f3f9ff"/>
- <Setter Property="Margin" Value="10"/>
+ <Setter Property="Margin" Value="5"/>
<Setter Property="Padding" Value="10"/>
</Style>
-
- <Style x:Key="DefaultDataGridRow" TargetType="DataGridRow" BasedOn="{StaticResource {x:Static pu:StyleKeys.DataGridRowStyle}}">
- <Setter Property="Background" Value="White"/>
- <Style.Triggers>
- <Trigger Property="AlternationIndex" Value="1">
- <Setter Property="Background" Value="#eeeeee"/>
- </Trigger>
- </Style.Triggers>
- </Style>
-
<Style x:Key="TableTextBlock" TargetType="TextBlock">
- <Setter Property="Padding" Value="0"/>
+ <Setter Property="Padding" Value="0,2"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
- </Style>
-
- <Style x:Key="DefaultDataGrid" TargetType="DataGrid" BasedOn="{StaticResource {x:Static pu:StyleKeys.DataGridStyle}}">
- <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="DataGridColumnHeader"
- BasedOn="{StaticResource {x:Static pu:StyleKeys.DataGridColumnHeaderStyle}}">
- <Setter Property="Padding" Value="10"/>
- <Setter Property="BorderThickness" Value="0"/>
- </Style>
- </Style.Resources>
- <Setter Property="pu:DataGridHelper.ColumnHeaderPadding" Value="0"/>
- <Setter Property="RowHeight" Value="30"/>
- <Setter Property="ColumnHeaderHeight" Value="36"/>
- <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="AutoGenerateColumns" Value="False"/>
- <Setter Property="CanUserAddRows" Value="False"/>
- <Setter Property="CanUserSortColumns" Value="False"/>
- <Setter Property="CanUserDeleteRows" Value="False"/>
- <Setter Property="RowHeaderWidth" Value="1"/>
- <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.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="TextWrapping" Value="Wrap"/>
</Style>
<Style x:Key="DefaultTreeView" TargetType="TreeView" BasedOn="{StaticResource {x:Static pu:StyleKeys.TreeViewStyle}}">
@@ -287,13 +225,6 @@
<Setter Property="pu:WindowXModalDialog.ButtonPanelMargin" Value="0,30,10,10"/>
</Style>
- <Popup x:Key="testPop" Placement="Relative" StaysOpen="True" Width="1920" Height="1080">
- <Rectangle x:Name="RectMask"
- Fill="Red"
- Opacity="0"
- Visibility="Visible" />
- </Popup>
-
<Style x:Key="DefaultListBox" TargetType="ListBox" BasedOn="{StaticResource {x:Static pu:StyleKeys.ListBoxStyle}}">
<Setter Property="pu:ListBoxHelper.ItemsHoverBackground" Value="{StaticResource SecondPrimaryColor}"/>
<Setter Property="pu:ListBoxHelper.ItemsHoverForeground" Value="{StaticResource SecondPrimaryColorContract}"/>
@@ -305,4 +236,45 @@
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
+
+ <Style x:Key="HeaderTabControl" TargetType="TabControl">
+ <Setter Property="pu:TabControlHelper.HeaderPanelAlignment" Value="Stretch"/>
+ <Setter Property="pu:TabControlHelper.ItemsBackground" Value="{DynamicResource VerBar}"/>
+ <Setter Property="pu:TabControlHelper.ItemsForeground" Value="#FFF"/>
+ <Setter Property="pu:TabControlHelper.ItemsSelectedForeground" Value="{DynamicResource PrimaryColor}"/>
+ <Setter Property="pu:TabControlHelper.ItemsFontSize" Value="14"/>
+ <Setter Property="pu:TabControlHelper.ItemsHeight" Value="30"/>
+ <Setter Property="pu:TabControlHelper.ItemsHorizontalHeaderAlignment" Value="Left"/>
+ <Setter Property="pu:TabControlHelper.ItemsHoverBackground" Value="{DynamicResource SecondPrimaryColor}"/>
+ <Setter Property="pu:TabControlHelper.ItemsHoverForeground" Value="#FFF"/>
+ <Setter Property="pu:TabControlHelper.ItemsPadding" Value="20,5,0,0"/>
+ <Setter Property="pu:TabControlHelper.ItemsRibbonLineCornerRadius" Value="4"/>
+ <Setter Property="pu:TabControlHelper.ItemsRibbonLineMargin" Value="0,5,0,5"/>
+ <Setter Property="pu:TabControlHelper.ItemsRibbonLineThickness" Value="4"/>
+ <Setter Property="pu:TabControlHelper.ItemsRibbonLineVisibility" Value="Visible"/>
+ <Setter Property="pu:TabControlHelper.ItemsSelectedBackground" Value="#FFF"/>
+ <Setter Property="pu:TabControlHelper.ItemsSelectedRibbonLineBrush" Value="#FFF"/>
+ <Setter Property="pu:TabControlHelper.ItemsSelectedRibbonLineThickness" Value="2"/>
+ <Setter Property="pu:TabControlHelper.ItemsWidth" Value="100"/>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type TabControl}">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="*"/>
+ </Grid.RowDefinitions>
+ <Border BorderThickness="1,1,1,0" BorderBrush="#acacac" Background="{DynamicResource VerBar}" Padding="2,2,10,0">
+ <TabPanel x:Name="HeaderPanel" Grid.Row="0" Panel.ZIndex="1" IsItemsHost="True"/>
+ </Border>
+
+ <Border Grid.Row="1" BorderBrush="{TemplateBinding BorderBrush}"
+ BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
+ <ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent"/>
+ </Border>
+ </Grid>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
</ResourceDictionary>
\ No newline at end of file
--
Gitblit v1.9.1