2025-08-20 12:10:13 +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:controls="clr-namespace:Melskin.Controls"
|
2026-02-20 15:31:44 +08:00
|
|
|
xmlns:converters="clr-namespace:Melskin.Converters">
|
2025-08-20 12:10:13 +08:00
|
|
|
|
2026-02-20 15:31:44 +08:00
|
|
|
<Style x:Key="DeleteButtonStyle" TargetType="Button">
|
2025-08-20 12:10:13 +08:00
|
|
|
<Setter Property="Background" Value="Transparent" />
|
|
|
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
|
|
|
<Setter Property="Cursor" Value="Hand" />
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="Button">
|
2025-12-23 21:35:54 +08:00
|
|
|
<controls:IconElement Foreground="{TemplateBinding Foreground}" Symbol="Delete" />
|
2025-09-08 19:49:09 +08:00
|
|
|
|
2025-08-20 12:10:13 +08:00
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource ErrorBrush}" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Style>
|
|
|
|
|
|
2025-09-06 00:36:23 +08:00
|
|
|
<Style TargetType="{x:Type controls:UploadArea}">
|
2025-08-20 12:10:13 +08:00
|
|
|
<Setter Property="AllowDrop" Value="True" />
|
|
|
|
|
<Setter Property="Background" Value="Transparent" />
|
2025-12-23 21:35:54 +08:00
|
|
|
<Setter Property="BorderBrush" Value="#bec8e4" />
|
2025-08-20 12:10:13 +08:00
|
|
|
<Setter Property="BorderThickness" Value="0" />
|
2025-09-06 00:36:23 +08:00
|
|
|
<!--<Setter Property="Padding" Value="8" />-->
|
2025-08-20 12:10:13 +08:00
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
2025-09-06 00:36:23 +08:00
|
|
|
<ControlTemplate TargetType="{x:Type controls:UploadArea}">
|
2025-08-20 12:10:13 +08:00
|
|
|
<Grid>
|
|
|
|
|
<StackPanel>
|
|
|
|
|
<!-- 上传区域 -->
|
|
|
|
|
<Border
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="PART_DropArea"
|
2025-08-26 21:33:20 +08:00
|
|
|
Background="{DynamicResource ControlBackgroundNormalBrush}"
|
2025-08-20 12:10:13 +08:00
|
|
|
Cursor="Hand"
|
2026-02-20 15:31:44 +08:00
|
|
|
SnapsToDevicePixels="True">
|
2025-08-20 12:10:13 +08:00
|
|
|
<Border.InputBindings>
|
|
|
|
|
<MouseBinding Command="{Binding SelectCommand, RelativeSource={RelativeSource TemplatedParent}}" MouseAction="LeftClick" />
|
|
|
|
|
</Border.InputBindings>
|
|
|
|
|
|
|
|
|
|
<Border
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="DropAreaBorder"
|
|
|
|
|
Padding="16"
|
2025-08-20 12:10:13 +08:00
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
BorderThickness="1"
|
2026-02-20 15:31:44 +08:00
|
|
|
CornerRadius="4">
|
2025-08-20 12:10:13 +08:00
|
|
|
<Border.Style>
|
|
|
|
|
<Style TargetType="Border">
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryNormalBrush}" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
</Border.Style>
|
|
|
|
|
|
|
|
|
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
2025-09-08 19:49:09 +08:00
|
|
|
<controls:IconElement
|
2026-02-20 15:31:44 +08:00
|
|
|
Padding="-6"
|
2025-12-23 21:35:54 +08:00
|
|
|
FontSize="80"
|
2025-09-08 19:49:09 +08:00
|
|
|
Foreground="{DynamicResource PrimaryNormalBrush}"
|
2025-12-23 21:35:54 +08:00
|
|
|
Symbol="Upload" />
|
2025-08-20 12:10:13 +08:00
|
|
|
<TextBlock
|
2026-02-20 15:31:44 +08:00
|
|
|
Margin="0"
|
|
|
|
|
HorizontalAlignment="Center"
|
2025-08-20 12:10:13 +08:00
|
|
|
FontSize="14"
|
|
|
|
|
FontWeight="SemiBold"
|
|
|
|
|
Foreground="{DynamicResource TextPrimaryBrush}"
|
|
|
|
|
Text="{TemplateBinding HintText}" />
|
2025-12-23 21:35:54 +08:00
|
|
|
<TextBlock
|
2026-02-20 15:31:44 +08:00
|
|
|
Margin="0,4,0,0"
|
|
|
|
|
HorizontalAlignment="Center"
|
2025-12-23 21:35:54 +08:00
|
|
|
FontSize="12"
|
|
|
|
|
Foreground="{DynamicResource TextSecondaryBrush}"
|
2025-12-28 11:47:54 +08:00
|
|
|
Text="{TemplateBinding Description}"
|
|
|
|
|
TextWrapping="WrapWithOverflow" />
|
2025-08-20 12:10:13 +08:00
|
|
|
</StackPanel>
|
|
|
|
|
</Border>
|
|
|
|
|
</Border>
|
|
|
|
|
|
2025-09-08 19:49:09 +08:00
|
|
|
<!-- 已选列表 -->
|
2025-12-23 21:35:54 +08:00
|
|
|
<ItemsControl
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="ItemList"
|
2025-12-23 21:35:54 +08:00
|
|
|
Margin="0,8,0,0"
|
2026-02-20 15:31:44 +08:00
|
|
|
ItemsSource="{TemplateBinding FileList}">
|
2025-08-20 12:10:13 +08:00
|
|
|
<ItemsControl.ItemTemplate>
|
2025-09-06 00:36:23 +08:00
|
|
|
<DataTemplate DataType="{x:Type controls:UploadFileItem}">
|
2025-08-20 12:10:13 +08:00
|
|
|
<Border
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="ItemBorder"
|
|
|
|
|
Margin="0,4"
|
|
|
|
|
Padding="8"
|
2025-09-08 19:49:09 +08:00
|
|
|
Background="{DynamicResource ControlBackgroundNormalBrush}"
|
2025-08-20 12:10:35 +08:00
|
|
|
BorderBrush="{DynamicResource BorderNormalBrush}"
|
2025-08-20 12:10:13 +08:00
|
|
|
BorderThickness="1"
|
2026-02-20 15:31:44 +08:00
|
|
|
CornerRadius="4">
|
2025-08-20 12:10:13 +08:00
|
|
|
<Grid>
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
|
|
|
|
<!-- 文件图标 -->
|
2025-09-08 19:49:09 +08:00
|
|
|
<controls:IconElement
|
2025-08-20 12:10:13 +08:00
|
|
|
Grid.Column="0"
|
2025-12-23 21:35:54 +08:00
|
|
|
Margin="0,0,8,0"
|
2026-02-20 15:31:44 +08:00
|
|
|
Foreground="{DynamicResource TextSecondaryBrush}"
|
2025-12-23 21:35:54 +08:00
|
|
|
Symbol="Files" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
|
|
|
|
<TextBlock
|
2026-01-02 17:30:30 +08:00
|
|
|
Grid.Column="1"
|
2026-02-20 15:31:44 +08:00
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
Foreground="{DynamicResource TextPrimaryBrush}"
|
2025-08-20 12:10:13 +08:00
|
|
|
Text="{Binding FileName}"
|
2026-02-20 15:31:44 +08:00
|
|
|
TextTrimming="CharacterEllipsis" />
|
2025-08-20 12:10:13 +08:00
|
|
|
|
|
|
|
|
<Button
|
2026-02-20 15:31:44 +08:00
|
|
|
Grid.Column="2"
|
2025-09-06 00:36:23 +08:00
|
|
|
Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:UploadArea}}, Path=RemoveItemCommand}"
|
2025-08-20 12:10:13 +08:00
|
|
|
CommandParameter="{Binding}"
|
2025-08-25 17:30:53 +08:00
|
|
|
Style="{StaticResource DeleteButtonStyle}" />
|
2025-08-20 12:10:13 +08:00
|
|
|
</Grid>
|
|
|
|
|
</Border>
|
|
|
|
|
<DataTemplate.Triggers>
|
2025-09-04 22:39:00 +08:00
|
|
|
<DataTrigger Binding="{Binding FileList, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={x:Static converters:NullOrEmptyConverter.Instance}}">
|
2025-08-20 12:10:13 +08:00
|
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
2026-02-20 15:31:44 +08:00
|
|
|
<Setter TargetName="ItemBorder" Property="Background" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
2025-08-20 12:10:13 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<!-- 可以根据文件状态显示不同样式 -->
|
|
|
|
|
<DataTrigger Binding="{Binding Status}" Value="Error">
|
|
|
|
|
<!--<Setter Property="Foreground" Value="#ff4d4f"/>-->
|
2026-02-20 15:31:44 +08:00
|
|
|
<Setter TargetName="ItemBorder" Property="BorderBrush" Value="{DynamicResource ErrorBrush}" />
|
2025-08-20 12:10:13 +08:00
|
|
|
</DataTrigger>
|
|
|
|
|
</DataTemplate.Triggers>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
</ItemsControl.ItemTemplate>
|
|
|
|
|
</ItemsControl>
|
|
|
|
|
|
|
|
|
|
</StackPanel>
|
|
|
|
|
<VisualStateManager.VisualStateGroups>
|
|
|
|
|
<VisualStateGroup x:Name="CommonStates">
|
|
|
|
|
<VisualState x:Name="Normal" />
|
|
|
|
|
<VisualState x:Name="Disabled">
|
|
|
|
|
<Storyboard>
|
|
|
|
|
<DoubleAnimation
|
|
|
|
|
Storyboard.TargetName="PART_DropArea"
|
|
|
|
|
Storyboard.TargetProperty="Opacity"
|
2026-02-20 15:31:44 +08:00
|
|
|
To="0.5"
|
|
|
|
|
Duration="0:0:0.2" />
|
2025-08-20 12:10:13 +08:00
|
|
|
</Storyboard>
|
|
|
|
|
</VisualState>
|
|
|
|
|
</VisualStateGroup>
|
|
|
|
|
<VisualStateGroup x:Name="DragDropStates">
|
|
|
|
|
<VisualState x:Name="DragLeave" />
|
|
|
|
|
<VisualState x:Name="DragOver">
|
|
|
|
|
<Storyboard>
|
|
|
|
|
<ColorAnimation
|
|
|
|
|
Storyboard.TargetName="DropAreaBorder"
|
|
|
|
|
Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
|
2026-02-20 15:31:44 +08:00
|
|
|
To="#4098FF"
|
|
|
|
|
Duration="0:0:0.2" />
|
2025-08-20 12:10:13 +08:00
|
|
|
</Storyboard>
|
|
|
|
|
</VisualState>
|
|
|
|
|
</VisualStateGroup>
|
|
|
|
|
</VisualStateManager.VisualStateGroups>
|
|
|
|
|
</Grid>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Style>
|
|
|
|
|
</ResourceDictionary>
|