From 0940f31b7eba1cf6b6a8c1fca72d97cf686e79f2 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期五, 04 七月 2025 10:43:00 +0800
Subject: [PATCH] 优化插件,完善TreeListView
---
HMI.UI/Style/PanuonResource.xaml | 219 +++++++++++++++++++++++++++++++++++-------------------
1 files changed, 141 insertions(+), 78 deletions(-)
diff --git a/HMI.UI/Style/PanuonResource.xaml b/HMI.UI/Style/PanuonResource.xaml
index 792c26e..01cd250 100644
--- a/HMI.UI/Style/PanuonResource.xaml
+++ b/HMI.UI/Style/PanuonResource.xaml
@@ -1,27 +1,33 @@
-锘�<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+锘�<ResourceDictionary
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ mc:Ignorable="d"
xmlns:ui="clr-namespace:HMI.UI"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:pw="https://opensource.panuon.com/wpf"
xmlns:pu="https://opensource.panuon.com/wpf-ui"
+ 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" />
<ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/>
- <pu:StyleDictionary Includes="TextBox,ComboBox,Button,DataGrid,TreeView,Menu" />
<ResourceDictionary Source="/HMI.UI;component/Resources/Font/Font.xaml"/>
</ResourceDictionary.MergedDictionaries>
-
<sys:Double x:Key="TitleFontSize">20</sys:Double>
<sys:Double x:Key="ContentFontSize">16</sys:Double>
+ <sys:Double x:Key="ContentFontSize2">14</sys:Double>
<Style x:Key="PrimaryButton" TargetType="Button" BasedOn="{StaticResource {x:Static pu:StyleKeys.ButtonStyle}}">
- <Setter Property="Background" Value="{StaticResource PrimaryColor}"/>
+ <Setter Property="Background" Value="{StaticResource VerBar}"/>
<Setter Property="Foreground" Value="#FFF"/>
<Setter Property="pu:IconHelper.FontFamily" Value="{StaticResource iconfont}"/>
<Setter Property="pu:IconHelper.Margin" Value="0,0,10,0"/>
- <Setter Property="Padding" Value="10"/>
+ <Setter Property="Padding" Value="8"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
+ <Setter Property="Focusable" Value="False"/>
</Style>
<Style x:Key="CommonButton" TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
@@ -31,33 +37,74 @@
</Style>
<Style x:Key="DangerButton" TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
- <Setter Property="Background" Value="{StaticResource DangerColor}"/>
+ <Setter Property="Background" Value="{StaticResource DangerVerBar}"/>
+ <Setter Property="Foreground" Value="{StaticResource DangerColorContrast}"/>
+ </Style>
+
+ <Style x:Key="SuccessButton" TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
+ <Setter Property="Background" Value="{StaticResource GreenVerBar}"/>
<Setter Property="Foreground" Value="{StaticResource DangerColorContrast}"/>
</Style>
<Style x:Key="AddBtn" TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
- <Setter Property="pu:ButtonHelper.Icon" Value=""/>
- <Setter Property="Content" Value="鏂板"/>
+ <Setter Property="pu:ButtonHelper.Icon" Value=""/>
+ <Setter Property="Content" Value="{DynamicResource App.Add}"/>
+ </Style>
+
+ <Style x:Key="EditBtn" TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
+ <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="鍒锋柊"/>
+ <Setter Property="pu:ButtonHelper.Icon" Value=""/>
+ <Setter Property="Content" Value="{DynamicResource App.Refresh}"/>
+ </Style>
+
+ <Style x:Key="QueryBtn" TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
+ <Setter Property="pu:ButtonHelper.Icon" Value=""/>
+ <Setter Property="Content" Value="{DynamicResource App.Query}"/>
+ </Style>
+
+ <Style x:Key="ExportBtn" TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
+ <Setter Property="pu:ButtonHelper.Icon" Value=""/>
+ <Setter Property="Content" Value="{DynamicResource App.Export}"/>
+ </Style>
+
+ <Style x:Key="ImportBtn" TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
+ <Setter Property="pu:ButtonHelper.Icon" Value=""/>
+ <Setter Property="Content" Value="{DynamicResource App.Import}"/>
+ </Style>
+
+ <Style x:Key="SaveBtn" TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
+ <Setter Property="pu:ButtonHelper.Icon" Value=""/>
+ <Setter Property="Content" Value="{DynamicResource App.Save}"/>
+ </Style>
+
+ <Style x:Key="ResetBtn" TargetType="Button" BasedOn="{StaticResource RfhBtn}">
+ <Setter Property="Content" Value="{DynamicResource App.Reset}"/>
+ </Style>
+
+ <Style x:Key="SettingBtn" TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
+ <Setter Property="pu:ButtonHelper.Icon" Value=""/>
+ <Setter Property="Content" Value="{DynamicResource App.Setting}"/>
</Style>
<Style x:Key="DelBtn" TargetType="Button" BasedOn="{StaticResource DangerButton}">
- <Setter Property="pu:ButtonHelper.Icon" Value=""/>
- <Setter Property="Content" Value="鍒犻櫎"/>
+ <Setter Property="pu:ButtonHelper.Icon" Value=""/>
+ <Setter Property="Content" Value="{DynamicResource App.Delete}"/>
</Style>
<Style x:Key="LinkButton" TargetType="Button" BasedOn="{StaticResource {x:Static pu:StyleKeys.ButtonStyle}}">
<Setter Property="Background" Value="{x:Null}" />
+ <Setter Property="Margin" Value="0" />
+ <Setter Property="Padding" Value="0" />
<Setter Property="Foreground" Value="{StaticResource PrimaryColor}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
- <TextBlock Text="{Binding}" TextDecorations="Underline" />
+ <TextBlock Text="{Binding}" Padding="0" HorizontalAlignment="Left" VerticalAlignment="Center" TextDecorations="Underline" />
</DataTemplate>
</Setter.Value>
</Setter>
@@ -67,71 +114,8 @@
<Setter Property="Foreground" Value="{StaticResource DangerColor}"/>
</Style>
- <Style x:Key="CardBoarder" TargetType="Border">
- <Setter Property="BorderBrush" Value="{StaticResource CommonBoarder}"/>
- <Setter Property="BorderThickness" Value="2"/>
- <Setter Property="Background" Value="#FFF"/>
- <Setter Property="Margin" Value="10"/>
- <Setter Property="Padding" Value="10"/>
- </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="0"/>
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="VerticalAlignment" Value="Stretch"/>
- <Setter Property="Background" Value="Transparent"/>
- </Style>
- <Style TargetType="TextBlock">
- <Setter Property="VerticalAlignment" Value="Center"/>
- <Setter Property="Padding" Value="10"/>
- </Style>
- </Style.Resources>
-
- <Setter Property="pu:DataGridHelper.ColumnHeaderBackground" Value="{StaticResource TableHeaderBackground}"/>
- <Setter Property="pu:DataGridHelper.ColumnHeaderHoverBackground" Value="{StaticResource TableHeaderBackground}"/>
- <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.RowHeaderBackground" Value="White"/>
- <Setter Property="pu:DataGridHelper.RowHeaderSeparatorBrush" Value="{StaticResource PrimaryColor}"/>
- <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="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="0"/>
- <Setter Property="IsReadOnly" Value="True"/>
- <Setter Property="GridLinesVisibility" Value="All"/>
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="FontSize" Value="{StaticResource ContentFontSize}"/>
- <Setter Property="RowHeight" Value="24"/>
- <Setter Property="ForceCursor" Value="True"/>
- <Setter Property="SelectionMode" Value="Single"/>
- <Setter Property="pu:DataGridHelper.ColumnHeaderBorderThickness" Value="0"/>
- <Setter Property="pu:DataGridHelper.ColumnHeaderPadding" Value="0"/>
- </Style>
-
- <Style x:Key="DefaultTreeView" TargetType="TreeView" BasedOn="{StaticResource {x:Static pu:StyleKeys.TreeViewStyle}}">
- <Setter Property="pu:TreeViewHelper.ItemsHoverBackground" Value="{StaticResource SecondPrimaryColor}"/>
- <Setter Property="pu:TreeViewHelper.ItemsHoverForeground" Value="{StaticResource SecondPrimaryColorContract}"/>
- <Setter Property="pu:TreeViewHelper.ItemsSelectedBackground" Value="{StaticResource PrimaryColor}"/>
- <Setter Property="pu:TreeViewHelper.ItemsSelectedForeground" Value="{StaticResource PrimaryColorContract}"/>
- <Setter Property="pu:TreeViewHelper.ItemsMargin" Value="0"/>
- <Setter Property="pu:TreeViewHelper.ItemsPadding" Value="7,5,7,5"/>
- <Setter Property="dp:TreeViewHelper.AutoExpand" Value="True"/>
- <Setter Property="FontSize" Value="{StaticResource ContentFontSize}"/>
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="BorderThickness" Value="0"/>
+ <Style x:Key="DeleteLink" TargetType="Button" BasedOn="{StaticResource DangerLinkButton}">
+ <Setter Property="Content" Value="{DynamicResource App.Delete}"/>
</Style>
<Style x:Key="RowLink" TargetType="Button" BasedOn="{StaticResource LinkButton}">
@@ -147,6 +131,54 @@
<Setter Property="Foreground" Value="#FFF"/>
</DataTrigger>
</Style.Triggers>
+ </Style>
+
+ <Style x:Key="EditLink" TargetType="Button" BasedOn="{StaticResource RowLink}">
+ <Setter Property="Content" Value="{DynamicResource App.Edit}"/>
+ </Style>
+
+ <Style x:Key="CommonToggle" TargetType="ToggleButton" BasedOn="{StaticResource {x:Static pu:StyleKeys.ToggleButtonStyle}}">
+ <Setter Property="Background" Value="#FFF"/>
+ <Setter Property="Foreground" Value="Black"/>
+ <Setter Property="BorderBrush" Value="LightGray"/>
+ <Setter Property="Cursor" Value="Hand"/>
+ </Style>
+
+ <Style x:Key="CommonMenu" TargetType="Menu" BasedOn="{StaticResource {x:Static pu:StyleKeys.MenuStyle}}">
+ <Setter Property="Background" Value="{StaticResource PrimaryColor}"/>
+ <Setter Property="Foreground" Value="#FFF"/>
+ <Setter Property="pu:IconHelper.FontFamily" Value="{StaticResource iconfont}"/>
+ <Setter Property="pu:IconHelper.Margin" Value="0,0,10,0"/>
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="Cursor" Value="Hand"/>
+ </Style>
+
+ <Style x:Key="CardBoarder" TargetType="Border">
+ <Setter Property="BorderBrush" Value="{StaticResource CommonBoarder}"/>
+ <Setter Property="BorderThickness" Value="2"/>
+ <Setter Property="Background" Value="#f3f9ff"/>
+ <Setter Property="Margin" Value="5"/>
+ <Setter Property="Padding" Value="10"/>
+ </Style>
+
+ <Style x:Key="TableTextBlock" TargetType="TextBlock">
+ <Setter Property="Padding" Value="0,2"/>
+ <Setter Property="Margin" Value="0"/>
+ <Setter Property="VerticalAlignment" Value="Center"/>
+ <Setter Property="TextWrapping" Value="Wrap"/>
+ </Style>
+
+ <Style x:Key="DefaultTreeView" TargetType="TreeView" BasedOn="{StaticResource {x:Static pu:StyleKeys.TreeViewStyle}}">
+ <Setter Property="pu:TreeViewHelper.ItemsHoverBackground" Value="{StaticResource SecondPrimaryColor}"/>
+ <Setter Property="pu:TreeViewHelper.ItemsHoverForeground" Value="{StaticResource SecondPrimaryColorContract}"/>
+ <Setter Property="pu:TreeViewHelper.ItemsSelectedBackground" Value="{StaticResource PrimaryColor}"/>
+ <Setter Property="pu:TreeViewHelper.ItemsSelectedForeground" Value="{StaticResource PrimaryColorContract}"/>
+ <Setter Property="pu:TreeViewHelper.ItemsMargin" Value="0"/>
+ <Setter Property="pu:TreeViewHelper.ItemsPadding" Value="7,5,7,5"/>
+ <Setter Property="dp:TreeViewHelper.AutoExpand" Value="True"/>
+ <Setter Property="FontSize" Value="{StaticResource ContentFontSize}"/>
+ <Setter Property="Background" Value="Transparent"/>
+ <Setter Property="BorderThickness" Value="0"/>
</Style>
<Style x:Key="DefaultTabControl" TargetType="TabControl">
@@ -171,4 +203,35 @@
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="{StaticResource TitleFontSize}"/>
</Style>
+
+ <Style x:Key="FormHeader" TargetType="TextBlock">
+ <Setter Property="VerticalAlignment" Value="Center"/>
+ <Setter Property="HorizontalAlignment" Value="Center"/>
+ <Setter Property="FontSize" Value="{StaticResource ContentFontSize2}"/>
+ </Style>
+
+ <Style x:Key="ModalWindow" TargetType="pu:WindowX">
+ <Setter Property="pu:WindowXCaption.Background" Value="{StaticResource ReHoriBar}"/>
+ <Setter Property="pu:WindowXModalDialog.ButtonStyle" Value="{StaticResource ModalButton}"/>
+ <Setter Property="pu:WindowXCaption.Foreground" Value="#FFF"/>
+ <Setter Property="pu:WindowXCaption.Buttons" Value="Close"/>
+ <Setter Property="pu:WindowXModalDialog.Buttons" Value="OKCancel"/>
+ <Setter Property="pu:WindowXModalDialog.CancelButtonContent"
+ Value="{DynamicResource App.Cancel}"/>
+ <Setter Property="pu:WindowXModalDialog.OKButtonContent"
+ Value="{DynamicResource App.Save}"/>
+ <Setter Property="pu:WindowXModalDialog.ButtonPanelMargin" Value="0,30,10,10"/>
+ </Style>
+
+ <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}"/>
+ <Setter Property="pu:ListBoxHelper.ItemsSelectedBackground" Value="{StaticResource PrimaryColor}"/>
+ <Setter Property="pu:ListBoxHelper.ItemsSelectedForeground" Value="{StaticResource PrimaryColorContract}"/>
+ <Setter Property="pu:ListBoxHelper.ItemsMargin" Value="0"/>
+ <Setter Property="pu:ListBoxHelper.ItemsPadding" Value="7,5,7,5"/>
+ <Setter Property="FontSize" Value="{StaticResource ContentFontSize}"/>
+ <Setter Property="Background" Value="Transparent"/>
+ <Setter Property="BorderThickness" Value="0"/>
+ </Style>
</ResourceDictionary>
\ No newline at end of file
--
Gitblit v1.9.1