C00225155-02/C00225155/MegaRobo.C00225155/MegaRobo.C00225155App/res/ListBoxStyle.xaml

127 lines
6.5 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="TechBlue" Color="#00BFFF"/>
<SolidColorBrush x:Key="TechBlueLight" Color="#87CEFA"/>
<SolidColorBrush x:Key="DarkBackground" Color="#121212"/>
<SolidColorBrush x:Key="DarkItemBackground" Color="#1E1E1E"/>
<SolidColorBrush x:Key="DarkItemHover" Color="#2D2D2D"/>
<SolidColorBrush x:Key="TextPrimary" Color="#E0E0E0"/>
<SolidColorBrush x:Key="TextSecondary" Color="#A0A0A0"/>
<!-- 自定义滚动条样式 - 左侧垂直滚动条 -->
<Style x:Key="VerticalScrollBarStyle" TargetType="{x:Type ScrollBar}">
<Setter Property="Width" Value="6"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<Grid Background="{TemplateBinding Background}">
<!-- 滚动轨道 -->
<Rectangle x:Name="TrackBackground"
Width="2"
RadiusX="1"
RadiusY="1"
Fill="#333333"
HorizontalAlignment="Center"/>
<!-- 滚动滑块 -->
<Thumb x:Name="PART_Track"
Width="4"
Margin="0,5"
HorizontalAlignment="Center"
Cursor="Hand">
<Thumb.Template>
<ControlTemplate>
<Border Background="{StaticResource TechBlue}"
CornerRadius="2"
Effect="{StaticResource GlowEffect}"/>
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Grid>
<!-- 滑块动画 -->
<ControlTemplate.Triggers>
<Trigger SourceName="PART_Track" Property="IsMouseOver" Value="True">
<Setter TargetName="PART_Track" Property="Width" Value="6"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 列表项样式 -->
<Style x:Key="ListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="Background" Value="{StaticResource DarkItemBackground}"/>
<Setter Property="Foreground" Value="{StaticResource TextPrimary}"/>
<Setter Property="Padding" Value="15,12"/>
<Setter Property="Margin" Value="0,0,0,1"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="ItemBorder"
Background="{TemplateBinding Background}"
BorderThickness="0,0,3,0"
BorderBrush="Transparent">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center"/>
</Border>
<!-- 触发器 - 悬停和选中效果 -->
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ItemBorder" Property="Background" Value="{StaticResource DarkItemHover}"/>
<Setter TargetName="ItemBorder" Property="BorderBrush" Value="{StaticResource TechBlueLight}"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="ItemBorder" Property="Background" Value="#2A2A3A"/>
<Setter TargetName="ItemBorder" Property="BorderBrush" Value="{StaticResource TechBlue}"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True"/>
<Condition Property="IsMouseOver" Value="True"/>
</MultiTrigger.Conditions>
<Setter TargetName="ItemBorder" Property="BorderBrush" Value="{StaticResource TechBlueLight}"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 列表框样式 -->
<Style x:Key="TechListBoxStyle" TargetType="{x:Type ListBox}">
<Setter Property="Background" Value="{StaticResource DarkBackground}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource ListBoxItemStyle}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer x:Name="ScrollViewer"
Padding="{TemplateBinding Padding}">
<ItemsPresenter/>
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 发光效果 -->
<DropShadowEffect x:Key="GlowEffect"
Color="#00BFFF"
BlurRadius="8"
Opacity="0.7"
ShadowDepth="0"/>
</ResourceDictionary>