Files
BR_YKC/上位机/YKC/App.xaml

275 lines
14 KiB
Plaintext
Raw Normal View History

2026-05-21 12:56:29 +08:00
<Application x:Class="YKC.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="LoginWindow.xaml">
<Application.Resources>
<!-- 颜色 -->
<SolidColorBrush x:Key="PrimaryBrush" Color="#3B82F6"/>
<SolidColorBrush x:Key="PrimaryDarkBrush" Color="#2563EB"/>
<SolidColorBrush x:Key="SidebarBrush" Color="#1E293B"/>
<SolidColorBrush x:Key="BgBrush" Color="#F0F2F5"/>
<SolidColorBrush x:Key="CardBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="BorderBrush" Color="#E2E8F0"/>
<SolidColorBrush x:Key="TextBrush" Color="#1E293B"/>
<SolidColorBrush x:Key="TextDimBrush" Color="#64748B"/>
<SolidColorBrush x:Key="TextLightBrush" Color="#94A3B8"/>
<SolidColorBrush x:Key="SuccessBrush" Color="#10B981"/>
<SolidColorBrush x:Key="DangerBrush" Color="#EF4444"/>
<!-- 圆角输入框样式 -->
<Style x:Key="FormInput" TargetType="TextBox">
<Setter Property="Padding" Value="10,8"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="BorderBrush" Value="#E2E8F0"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border Background="White" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4">
<ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 密码框样式 -->
<Style x:Key="PwdInput" TargetType="PasswordBox">
<Setter Property="Padding" Value="10,8"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="BorderBrush" Value="#E2E8F0"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="PasswordBox">
<Border Background="White" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4">
<Grid>
<Rectangle Fill="Transparent"/>
<ScrollViewer x:Name="PART_ContentHost"
Margin="{TemplateBinding Padding}"
VerticalAlignment="Center"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 蓝色主按钮 -->
<Style x:Key="BtnPrimary" TargetType="Button">
<Setter Property="Background" Value="#3B82F6"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Padding" Value="20,9"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="4"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#2563EB"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 白色边框按钮 -->
<Style x:Key="BtnOutline" TargetType="Button" BasedOn="{StaticResource BtnPrimary}">
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="#3B82F6"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#3B82F6"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#EFF6FF"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 红色危险按钮 -->
<Style x:Key="BtnDanger" TargetType="Button" BasedOn="{StaticResource BtnPrimary}">
<Setter Property="Background" Value="#EF4444"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#DC2626"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 侧边导航按钮 -->
<Style x:Key="NavBtn" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#8899AA"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Height" Value="44"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="Padding" Value="22,0,0,0"/>
<Setter Property="BorderThickness" Value="3,0,0,0"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Border Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#1A2433"/>
<Setter Property="Foreground" Value="#CCDDEE"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 表单标签(在输入框上方) -->
<Style x:Key="FieldLabel" TargetType="TextBlock">
<Setter Property="Foreground" Value="#64748B"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Margin" Value="0,0,0,4"/>
</Style>
<!-- 信息行标签(灰色小字) -->
<Style x:Key="InfoLabel" TargetType="TextBlock">
<Setter Property="Foreground" Value="#94A3B8"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Margin" Value="0,0,0,2"/>
</Style>
<!-- 信息行值 -->
<Style x:Key="InfoValue" TargetType="TextBlock">
<Setter Property="Foreground" Value="#1E293B"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Margin" Value="0,0,0,8"/>
</Style>
<!-- 徽章 -->
<Style x:Key="Badge" TargetType="TextBlock">
<Setter Property="FontSize" Value="11"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Padding" Value="8,3"/>
</Style>
<!-- 下拉框样式 -->
<Style x:Key="StyledCombo" TargetType="ComboBox">
<Setter Property="FontSize" Value="13"/>
<Setter Property="Height" Value="34"/>
<Setter Property="Foreground" Value="#1E293B"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Background" Value="White"/>
<Setter Property="Padding" Value="12,0,10,0"/>
<Setter Property="MinWidth" Value="60"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<Border x:Name="border" Background="{TemplateBinding Background}"
BorderBrush="{StaticResource BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ContentPresenter Grid.Column="0" Margin="{TemplateBinding Padding}"
VerticalAlignment="Center"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding ItemTemplate}"
IsHitTestVisible="False"/>
<Path Grid.Column="1" Data="M0,0 L7,0 L3.5,5 Z"
Fill="#94A3B8" Margin="0,0,10,0"
VerticalAlignment="Center" Stretch="Uniform"/>
</Grid>
</Border>
<Popup x:Name="PART_Popup" AllowsTransparency="True"
IsOpen="{TemplateBinding IsDropDownOpen}"
Placement="Bottom" Focusable="False"
PopupAnimation="Fade"
VerticalOffset="2">
<Border x:Name="dropDownBorder" Background="White"
BorderBrush="#E2E8F0" BorderThickness="1"
CornerRadius="6" Padding="4"
Effect="{Binding RelativeSource={RelativeSource Self}, Path=Tag}">
<ScrollViewer>
<ItemsPresenter/>
</ScrollViewer>
</Border>
</Popup>
<!-- 点击切换的 ToggleButton -->
<ToggleButton x:Name="toggleBtn"
IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Focusable="False"
Background="Transparent"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="BorderBrush" Value="#3B82F6"/>
<Setter TargetName="border" Property="Background" Value="#F8FAFC"/>
</Trigger>
<Trigger Property="IsDropDownOpen" Value="True">
<Setter TargetName="border" Property="BorderBrush" Value="#3B82F6"/>
<Setter TargetName="border" Property="Background" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 下拉框项样式 -->
<Style TargetType="ComboBoxItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#1E293B"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Padding" Value="12,8"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border x:Name="border" Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}" CornerRadius="3">
<ContentPresenter/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#EFF6FF"/>
<Setter Property="Foreground" Value="#3B82F6"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="border" Property="Background" Value="#DBEAFE"/>
<Setter Property="Foreground" Value="#1E40AF"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Application.Resources>
</Application>