Files

258 lines
15 KiB
Plaintext
Raw Permalink Normal View History

2025-07-31 20:12:01 +08:00
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2026-02-20 15:31:44 +08:00
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
2026-01-02 17:30:41 +08:00
xmlns:assists="clr-namespace:Melskin.Assists"
2026-02-20 15:31:44 +08:00
xmlns:internal="clr-namespace:Melskin.Converters.Internal">
<Style x:Key="GridViewColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">
<Setter Property="Background" Value="{DynamicResource DividerBrush}" />
2025-07-11 09:20:23 +08:00
<Setter Property="Width" Value="12" />
<Setter Property="Cursor" Value="SizeNS" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
2026-02-20 15:31:44 +08:00
<Grid Margin="6,6,-6,6" Background="Transparent">
2025-07-31 20:12:01 +08:00
<Border
2026-02-20 15:31:44 +08:00
Width="1"
2026-01-02 17:30:30 +08:00
Padding="{TemplateBinding Padding}"
2026-02-20 15:31:44 +08:00
HorizontalAlignment="Center"
Background="{TemplateBinding Background}" />
2025-07-11 09:20:23 +08:00
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
2025-08-12 23:08:54 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
2025-07-11 09:20:23 +08:00
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="8,4" />
2025-08-12 23:08:54 +08:00
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
2025-07-11 09:20:23 +08:00
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
<Grid SnapsToDevicePixels="true">
2025-07-31 20:12:01 +08:00
<Border
2026-02-20 15:31:44 +08:00
x:Name="HeaderBorder"
2026-01-02 17:30:30 +08:00
Margin="2"
Padding="{TemplateBinding Padding}"
2026-02-20 15:31:44 +08:00
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="4">
2025-07-31 20:12:01 +08:00
<ContentPresenter
2026-02-20 15:31:44 +08:00
x:Name="HeaderContent"
2025-07-31 20:12:01 +08:00
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
2026-01-02 17:30:30 +08:00
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
2026-02-20 15:31:44 +08:00
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
2025-07-11 09:20:23 +08:00
</Border>
2025-07-31 20:12:01 +08:00
<Thumb
2026-02-20 15:31:44 +08:00
x:Name="PART_HeaderGripper"
2025-07-31 20:12:01 +08:00
HorizontalAlignment="Right"
2026-02-20 15:31:44 +08:00
Style="{StaticResource GridViewColumnHeaderGripperStyle}" />
2025-07-11 09:20:23 +08:00
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
2026-02-20 15:31:44 +08:00
<Setter TargetName="HeaderBorder" Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
2025-07-11 09:20:23 +08:00
</Trigger>
<Trigger Property="IsPressed" Value="true">
2026-02-20 15:31:44 +08:00
<Setter TargetName="HeaderBorder" Property="Background" Value="{DynamicResource BackgroundFloatingBrush}" />
2025-07-31 20:12:01 +08:00
<!--<Setter Property="Visibility" TargetName="PART_HeaderGripper"
2025-07-11 09:20:23 +08:00
Value="Hidden"/>-->
</Trigger>
<Trigger Property="Height" Value="Auto">
<Setter Property="MinHeight" Value="20" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
2025-08-12 23:08:54 +08:00
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
2025-07-11 09:20:23 +08:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Role" Value="Floating">
<Setter Property="Opacity" Value="0.4" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
<Canvas x:Name="PART_FloatingHeaderCanvas">
2025-07-31 20:12:01 +08:00
<Rectangle
2026-02-20 15:31:44 +08:00
Width="{TemplateBinding ActualWidth}"
2026-01-02 17:30:30 +08:00
Height="{TemplateBinding ActualHeight}"
2026-02-20 15:31:44 +08:00
Fill="{DynamicResource BackgroundFloatingBrush}"
2025-07-31 20:12:01 +08:00
Opacity="0.4"
RadiusX="2"
2026-02-20 15:31:44 +08:00
RadiusY="2" />
2025-07-11 09:20:23 +08:00
</Canvas>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="Role" Value="Padding">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
2025-07-31 20:12:01 +08:00
<Border
2026-02-20 15:31:44 +08:00
x:Name="HeaderBorder"
2025-07-31 20:12:01 +08:00
Background="{TemplateBinding Background}"
2026-02-20 15:31:44 +08:00
BorderBrush="{TemplateBinding BorderBrush}" />
2025-07-11 09:20:23 +08:00
<ControlTemplate.Triggers>
<Trigger Property="Height" Value="Auto">
<Setter Property="MinHeight" Value="20" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="{x:Type ListView}">
2025-08-26 21:33:20 +08:00
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
2025-08-12 23:08:54 +08:00
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
2025-07-11 09:20:23 +08:00
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="0,4" />
<Setter Property="FontSize" Value="14" />
2025-08-12 23:08:54 +08:00
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
2025-07-11 09:20:23 +08:00
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.CanContentScroll" Value="true" />
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="VerticalContentAlignment" Value="Center" />
2025-07-31 20:12:01 +08:00
<Setter Property="AlternationCount" Value="{Binding RelativeSource={RelativeSource Self}, Path=Items.Count}" />
2025-07-11 09:20:23 +08:00
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListView}">
2025-07-31 20:12:01 +08:00
<Border
2026-02-20 15:31:44 +08:00
x:Name="Bd"
2025-07-31 20:12:01 +08:00
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
2026-02-20 15:31:44 +08:00
SnapsToDevicePixels="true">
2025-07-11 09:20:23 +08:00
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
2025-08-12 23:08:54 +08:00
<Border Background="{DynamicResource BackgroundLayoutBrush}" CornerRadius="4,4,0,0">
2025-07-31 20:12:01 +08:00
<ScrollViewer
2026-02-20 15:31:44 +08:00
x:Name="headerScroll"
2025-07-31 20:12:01 +08:00
HorizontalScrollBarVisibility="Hidden"
2026-02-20 15:31:44 +08:00
VerticalScrollBarVisibility="Disabled">
2025-07-31 20:12:01 +08:00
<GridViewHeaderRowPresenter
2026-02-20 15:31:44 +08:00
Margin="4,0"
2025-07-31 20:12:01 +08:00
AllowsColumnReorder="{Binding View.AllowsColumnReorder, RelativeSource={RelativeSource TemplatedParent}}"
ColumnHeaderContainerStyle="{Binding View.ColumnHeaderContainerStyle, RelativeSource={RelativeSource TemplatedParent}}"
ColumnHeaderContextMenu="{Binding View.ColumnHeaderContextMenu, RelativeSource={RelativeSource TemplatedParent}}"
ColumnHeaderTemplate="{Binding View.ColumnHeaderTemplate, RelativeSource={RelativeSource TemplatedParent}}"
ColumnHeaderToolTip="{Binding View.ColumnHeaderToolTip, RelativeSource={RelativeSource TemplatedParent}}"
Columns="{Binding View.Columns, RelativeSource={RelativeSource TemplatedParent}}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
2025-07-11 09:20:23 +08:00
</ScrollViewer>
</Border>
2025-07-31 20:12:01 +08:00
<ScrollViewer
Grid.Row="1"
Padding="{TemplateBinding Padding}"
2026-02-20 15:31:44 +08:00
assists:ControlAssist.SynchronizedScroll="{Binding ElementName=headerScroll}"
Focusable="false">
2025-07-11 09:20:23 +08:00
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</ScrollViewer>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
2026-02-20 15:31:44 +08:00
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
2025-07-11 09:20:23 +08:00
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="true" />
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="false" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Padding" Value="4" />
2025-07-31 20:12:01 +08:00
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
2025-07-11 09:20:23 +08:00
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
2025-08-26 21:33:20 +08:00
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
2025-07-11 09:20:23 +08:00
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Grid Margin="4,0">
2025-08-26 21:33:20 +08:00
<!-- 偶数行颜色 -->
2025-07-31 20:12:01 +08:00
<Border
2025-08-26 21:33:20 +08:00
Background="{DynamicResource BackgroundInterlacedBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
IsHitTestVisible="False"
Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(ItemsControl.AlternationIndex), Converter={x:Static internal:InterlacedBackgroundConverter.Instance}}" />
<Border
2026-02-20 15:31:44 +08:00
x:Name="Bd"
Padding="{TemplateBinding Padding}"
2025-07-31 20:12:01 +08:00
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
2026-02-20 15:31:44 +08:00
SnapsToDevicePixels="true">
2025-07-11 09:20:23 +08:00
<Grid>
<GridViewRowPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
2025-07-31 20:12:01 +08:00
<ContentPresenter
2026-02-20 15:31:44 +08:00
x:Name="contentPresenter"
2025-07-31 20:12:01 +08:00
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
2026-02-20 15:31:44 +08:00
Visibility="Collapsed" />
2025-07-11 09:20:23 +08:00
</Grid>
</Border>
2025-08-26 21:33:20 +08:00
2025-07-11 09:20:23 +08:00
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="GridView.ColumnCollection" Value="{x:Null}">
2026-02-20 15:31:44 +08:00
<Setter TargetName="contentPresenter" Property="Visibility" Value="Visible" />
2025-07-11 09:20:23 +08:00
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
2026-02-20 15:31:44 +08:00
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
2025-07-11 09:20:23 +08:00
</MultiTrigger>
2025-07-31 20:12:01 +08:00
<!-- 选中对象无焦点 -->
2025-07-11 09:20:23 +08:00
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Selector.IsSelectionActive" Value="False" />
<Condition Property="IsSelected" Value="True" />
</MultiTrigger.Conditions>
2026-02-20 15:31:44 +08:00
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource BackgroundFloatingBrush}" />
2025-07-11 09:20:23 +08:00
</MultiTrigger>
2025-07-31 20:12:01 +08:00
<!-- 选中对象有焦点 -->
2025-07-11 09:20:23 +08:00
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Selector.IsSelectionActive" Value="True" />
<Condition Property="IsSelected" Value="True" />
</MultiTrigger.Conditions>
2026-02-20 15:31:44 +08:00
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource PrimaryNormalBrush}" />
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource TextAccentBrush}" />
2025-07-11 09:20:23 +08:00
</MultiTrigger>
<Trigger Property="IsEnabled" Value="False">
2026-02-20 15:31:44 +08:00
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
2025-07-11 09:20:23 +08:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>