添加项目文件。
This commit is contained in:
59
SamplePreSystem.UI/Styles/BaseButtonStyle.xaml
Normal file
59
SamplePreSystem.UI/Styles/BaseButtonStyle.xaml
Normal file
@@ -0,0 +1,59 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">
|
||||
|
||||
<!--<Style TargetType="Button">
|
||||
<Setter Property="Background" Value="#106EBE"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
-->
|
||||
<!--<Setter Property="FontSize" Value="16"/>-->
|
||||
<!--<Setter Property="FontFamily" Value="Assets/font/#iconfont"/>-->
|
||||
<!--
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background }">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="LightBlue"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>-->
|
||||
|
||||
|
||||
<!-- ===================== MaterialDesign 图标+文字按钮 ===================== -->
|
||||
<Style
|
||||
x:Key="IconTextButtonStyle"
|
||||
BasedOn="{StaticResource MaterialDesignRaisedButton}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Width" Value="120" />
|
||||
<Setter Property="Height" Value="30" />
|
||||
<Setter Property="ContentTemplate">
|
||||
<Setter.Value>
|
||||
<!-- 关键:用 DataTemplate不破坏按钮样式 -->
|
||||
<DataTemplate>
|
||||
<StackPanel
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<materialDesign:PackIcon
|
||||
Width="20"
|
||||
Height="20"
|
||||
Kind="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Tag}" />
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
23
SamplePreSystem.UI/Styles/BaseDataGrid.xaml
Normal file
23
SamplePreSystem.UI/Styles/BaseDataGrid.xaml
Normal file
@@ -0,0 +1,23 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style x:Key="XBaseDataGrid" TargetType="DataGrid">
|
||||
|
||||
<!-- 表头样式:增加内边距 -->
|
||||
<Setter Property="ColumnHeaderStyle">
|
||||
<Setter.Value>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<!-- 表头背景色 -->
|
||||
<Setter Property="Background" Value="#F5F5F5" />
|
||||
<!-- 表头文字颜色 -->
|
||||
<!--
|
||||
<Setter Property="Foreground" Value="#2C7DBD"/>-->
|
||||
<!-- 表头高度 -->
|
||||
<Setter Property="Height" Value="35" />
|
||||
<!-- 表头文字居中 -->
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||
</Style>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
13
SamplePreSystem.UI/Styles/BaseTreeView.xaml
Normal file
13
SamplePreSystem.UI/Styles/BaseTreeView.xaml
Normal file
@@ -0,0 +1,13 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
|
||||
<!-- 仅针对字体、间距的TreeView极简美化样式 -->
|
||||
<Style TargetType="TreeView">
|
||||
<!-- TreeView整体内边距:避免控件紧贴窗口 -->
|
||||
<Setter Property="Padding" Value="8" />
|
||||
<!-- 整体背景:白色更清爽 -->
|
||||
<Setter Property="Background" Value="White" />
|
||||
<!-- 滚动条优化:避免文字被遮挡 -->
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
277
SamplePreSystem.UI/Styles/BaseWindowStyle.xaml
Normal file
277
SamplePreSystem.UI/Styles/BaseWindowStyle.xaml
Normal file
@@ -0,0 +1,277 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
|
||||
<ControlTemplate x:Key="WindowTemplateKey" TargetType="{x:Type Window}">
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<Grid>
|
||||
<AdornerDecorator>
|
||||
<ContentPresenter />
|
||||
</AdornerDecorator>
|
||||
<ResizeGrip
|
||||
x:Name="WindowResizeGrip"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
IsTabStop="false"
|
||||
Visibility="Collapsed" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="ResizeMode" Value="CanResizeWithGrip" />
|
||||
<Condition Property="WindowState" Value="Normal" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="WindowResizeGrip" Property="Visibility" Value="Visible" />
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<ControlTemplate x:Key="BaseWindowControlTemplate" TargetType="{x:Type Window}">
|
||||
<DockPanel LastChildFill="True">
|
||||
<!-- 外边框 -->
|
||||
<Border
|
||||
x:Name="borderTitle"
|
||||
Width="Auto"
|
||||
Height="Auto"
|
||||
Background="#0170cc"
|
||||
CornerRadius="0,0,0,0"
|
||||
DockPanel.Dock="Top">
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<TextBlock
|
||||
Name="Title"
|
||||
Grid.Column="0"
|
||||
Margin="20,0,2,2"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Foreground="White"
|
||||
Text="{TemplateBinding Title}" />
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
|
||||
<!-- 最小化按钮 -->
|
||||
<!--
|
||||
<Button
|
||||
x:Name="btnMin"
|
||||
Margin="2,2,2,2"
|
||||
Content="M"
|
||||
Style="{DynamicResource MinButtonStyle}" />
|
||||
|
||||
|
||||
-->
|
||||
<!-- 最大化按钮 -->
|
||||
<!--
|
||||
<Button
|
||||
x:Name="btnMax"
|
||||
Margin="2,2,2,2"
|
||||
Content="M"
|
||||
Style="{DynamicResource MaxButtonStyle}" />-->
|
||||
<!-- 关闭按钮 -->
|
||||
|
||||
<Button
|
||||
x:Name="btnClose"
|
||||
Margin="2,2,2,2"
|
||||
Content="🗙"
|
||||
Style="{DynamicResource CloseButtonStyle2}" />
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
</Border>
|
||||
<Border
|
||||
Width="Auto"
|
||||
Height="Auto"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="LightGray"
|
||||
BorderThickness="2"
|
||||
CornerRadius="0,0,4,4"
|
||||
DockPanel.Dock="Top">
|
||||
<AdornerDecorator>
|
||||
<ContentPresenter />
|
||||
</AdornerDecorator>
|
||||
</Border>
|
||||
</DockPanel>
|
||||
</ControlTemplate>
|
||||
<Style x:Key="BaseWindowStyle" TargetType="{x:Type Window}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
|
||||
<Setter Property="Template" Value="{StaticResource BaseWindowControlTemplate}" />
|
||||
|
||||
<Setter Property="AllowsTransparency" Value="True" />
|
||||
<Setter Property="WindowStyle" Value="None" />
|
||||
<Setter Property="BorderBrush" Value="#FF7097D0" />
|
||||
<Setter Property="BorderThickness" Value="4,4,4,4" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="ResizeMode" Value="CanResizeWithGrip">
|
||||
<Setter Property="Template" Value="{StaticResource WindowTemplateKey}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<!-- 最小化按钮 -->
|
||||
<Style x:Key="MinButtonStyle" TargetType="{x:Type Button}">
|
||||
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<!-- 修改模板属性 -->
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<!-- 控件模板 -->
|
||||
<ControlTemplate TargetType="Button">
|
||||
<!-- 背景色 -->
|
||||
<Border
|
||||
x:Name="back"
|
||||
Margin="1"
|
||||
Padding="2,0,0,0"
|
||||
Background="#FFFFE9C9"
|
||||
BorderBrush="#FFCDA05F"
|
||||
BorderThickness="1"
|
||||
CornerRadius="0"
|
||||
Opacity="0.8">
|
||||
<!-- 按钮内容 -->
|
||||
<Path
|
||||
x:Name="cp"
|
||||
Width="12"
|
||||
Height="12"
|
||||
Fill="Black"
|
||||
Stroke="#FFCEA15F"
|
||||
StrokeThickness="3">
|
||||
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M 0,6 H 6,6 " />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
|
||||
<Setter TargetName="back" Property="Background" Value="#FFD4BD9B" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="back" Property="Background" Value="#FFCDA05F" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 最大化按钮 -->
|
||||
<Style x:Key="MaxButtonStyle" TargetType="{x:Type Button}">
|
||||
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<!-- 修改模板属性 -->
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<!-- 控件模板 -->
|
||||
<ControlTemplate TargetType="Button">
|
||||
<!-- 背景色 -->
|
||||
<Border
|
||||
x:Name="back"
|
||||
Margin="1"
|
||||
Padding="2,0,0,0"
|
||||
Background="#FFFFE9C9"
|
||||
BorderBrush="#FFCDA05F"
|
||||
BorderThickness="1"
|
||||
CornerRadius="0"
|
||||
Opacity="0.8">
|
||||
<!-- 按钮内容 -->
|
||||
<Path
|
||||
x:Name="cp"
|
||||
Width="12"
|
||||
Height="12"
|
||||
Stroke="#FFCEA15F"
|
||||
StrokeThickness="3">
|
||||
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M 0,0 L 0,12 12,12 12,0 0,0" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
|
||||
<Setter TargetName="back" Property="Background" Value="#FFD4BD9B" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="back" Property="Background" Value="#FFCDA05F" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 关闭按钮 -->
|
||||
<Style x:Key="CloseButtonStyle" TargetType="{x:Type Button}">
|
||||
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<!-- 修改模板属性 -->
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<!-- 控件模板 -->
|
||||
<ControlTemplate TargetType="Button">
|
||||
<!-- 背景色 -->
|
||||
<Border
|
||||
x:Name="back"
|
||||
Width="30"
|
||||
Height="30"
|
||||
Margin="0,0"
|
||||
Padding="0,0,0,0"
|
||||
BorderThickness="1"
|
||||
CornerRadius="0">
|
||||
<!-- 按钮内容 -->
|
||||
<Path
|
||||
x:Name="cp"
|
||||
Width="12"
|
||||
Height="12"
|
||||
Stroke="White"
|
||||
StrokeThickness="2">
|
||||
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M 0,0 L 12,12 M 0,12 L 12,0" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
|
||||
<Setter TargetName="back" Property="Background" Value="DarkRed" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="back" Property="Background" Value="DarkRed" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
<Style
|
||||
x:Key="CloseButtonStyle2"
|
||||
BasedOn="{StaticResource MaterialDesignFlatMidBgButton}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Width" Value="32" />
|
||||
<Setter Property="Height" Value="32" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="DarkRed" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user