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:conv="clr-namespace:Melskin.Converters"
|
|
|
|
|
xmlns:dec="clr-namespace:Melskin.Controls.Decorations"
|
2026-02-20 15:31:44 +08:00
|
|
|
xmlns:internal="clr-namespace:Melskin.Converters.Internal">
|
2025-07-31 20:12:24 +08:00
|
|
|
<Style TargetType="{x:Type dec:SlotBorder}">
|
2025-07-11 09:20:23 +08:00
|
|
|
<Setter Property="Focusable" Value="False" />
|
2025-08-12 23:08:54 +08:00
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
2025-08-26 21:33:20 +08:00
|
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
2025-08-12 23:08:54 +08:00
|
|
|
<Setter Property="LightShadowBrush" Value="{DynamicResource LightShadowBrush}" />
|
|
|
|
|
<Setter Property="DarkShadowBrush" Value="{DynamicResource DarkShadowBrush}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
|
|
|
|
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
2025-08-20 12:10:13 +08:00
|
|
|
<Setter Property="CornerRadius" Value="4" />
|
|
|
|
|
<Setter Property="Padding" Value="2" />
|
2025-07-11 09:20:23 +08:00
|
|
|
<Setter Property="ShaderEnabled" Value="True" />
|
|
|
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
|
|
|
<Setter Property="FontSize" Value="14" />
|
|
|
|
|
<Setter Property="Intensity" Value="1" />
|
|
|
|
|
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
2025-07-31 20:12:24 +08:00
|
|
|
<ControlTemplate TargetType="{x:Type dec:SlotBorder}">
|
2025-07-11 09:20:23 +08:00
|
|
|
<Grid>
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- 隐藏阴影的时候呈现背景色 -->
|
2025-08-20 12:10:13 +08:00
|
|
|
<!-- 默认4的边距显示光影效果 -->
|
2025-07-31 20:12:01 +08:00
|
|
|
<Border
|
2026-02-20 15:31:44 +08:00
|
|
|
Margin="4"
|
2025-07-31 20:12:01 +08:00
|
|
|
Background="{TemplateBinding Background}"
|
2026-02-20 15:31:44 +08:00
|
|
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- 内阴影效果 -->
|
2025-12-23 21:35:54 +08:00
|
|
|
<Grid Visibility="{TemplateBinding ShaderEnabled, Converter={x:Static conv:BooleanToVisibilityConverter.CollapsedInstance}}">
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- 背景填充 -->
|
|
|
|
|
<Rectangle Fill="{TemplateBinding Background}" />
|
|
|
|
|
<!-- 左上阴影 -->
|
|
|
|
|
<Border
|
2026-01-02 17:30:30 +08:00
|
|
|
Margin="{TemplateBinding Intensity,
|
2026-02-20 15:31:44 +08:00
|
|
|
Converter={x:Static internal:IntensityToSlotShadowMarginConverter.Instance}}"
|
|
|
|
|
Background="{TemplateBinding DarkShadowBrush}"
|
|
|
|
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- 右下高亮 -->
|
|
|
|
|
<Border
|
2026-01-02 17:30:30 +08:00
|
|
|
Margin="{TemplateBinding Intensity,
|
2026-02-20 15:31:44 +08:00
|
|
|
Converter={x:Static internal:IntensityToSlotLightMarginConverter.Instance}}"
|
|
|
|
|
Background="{TemplateBinding LightShadowBrush}"
|
|
|
|
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- 背景中央 -->
|
|
|
|
|
<Border
|
2026-01-02 17:30:30 +08:00
|
|
|
Margin="{TemplateBinding Intensity,
|
2026-02-20 15:31:44 +08:00
|
|
|
Converter={x:Static internal:IntensityToSlotMarginConverter.Instance}}"
|
|
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- 裁切区域 -->
|
2025-07-11 09:20:23 +08:00
|
|
|
<Grid.Clip>
|
2025-07-31 20:12:01 +08:00
|
|
|
<MultiBinding
|
2025-07-31 20:12:24 +08:00
|
|
|
Converter="{x:Static internal:CreateSlotClipGeometryConverter.Instance}"
|
2025-07-31 20:12:01 +08:00
|
|
|
ConverterParameter="4"
|
|
|
|
|
Mode="OneWay">
|
|
|
|
|
<Binding
|
|
|
|
|
Mode="OneWay"
|
2025-08-20 12:10:13 +08:00
|
|
|
Path="CornerRadius"
|
2025-07-31 20:12:01 +08:00
|
|
|
RelativeSource="{RelativeSource TemplatedParent}" />
|
|
|
|
|
<Binding
|
|
|
|
|
Mode="OneWay"
|
|
|
|
|
Path="ActualWidth"
|
|
|
|
|
RelativeSource="{RelativeSource TemplatedParent}" />
|
|
|
|
|
<Binding
|
|
|
|
|
Mode="OneWay"
|
|
|
|
|
Path="ActualHeight"
|
|
|
|
|
RelativeSource="{RelativeSource TemplatedParent}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</MultiBinding>
|
|
|
|
|
</Grid.Clip>
|
|
|
|
|
<Grid.Effect>
|
2025-07-31 20:12:24 +08:00
|
|
|
<BlurEffect Radius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Intensity, Converter={x:Static internal:IntensityToSlotBlurConverter.Instance}, Mode=OneWay}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</Grid.Effect>
|
|
|
|
|
</Grid>
|
2025-07-31 20:12:01 +08:00
|
|
|
<!-- 显示边框和内容 -->
|
2025-08-20 12:10:13 +08:00
|
|
|
<!-- 默认4的边距显示光影效果 -->
|
2025-07-31 20:12:01 +08:00
|
|
|
<Border
|
2026-02-20 15:31:44 +08:00
|
|
|
Margin="4"
|
2025-07-31 20:12:01 +08:00
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
2026-02-20 15:31:44 +08:00
|
|
|
CornerRadius="{TemplateBinding CornerRadius}">
|
2025-07-31 20:12:01 +08:00
|
|
|
<ContentPresenter
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="contentPresenter"
|
2026-01-02 17:30:30 +08:00
|
|
|
Margin="{TemplateBinding Padding}"
|
2026-02-20 15:31:44 +08:00
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
|
|
|
Focusable="False"
|
2025-07-31 20:12:01 +08:00
|
|
|
RecognizesAccessKey="True"
|
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
2026-02-20 15:31:44 +08:00
|
|
|
TextElement.Foreground="{TemplateBinding Foreground}" />
|
2025-07-11 09:20:23 +08:00
|
|
|
</Border>
|
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Style>
|
|
|
|
|
</ResourceDictionary>
|