Files
Shrlalgo.RvKits/SyminUI/SyminUI/Themes/Decorations/EmbossBorder.xaml

72 lines
4.2 KiB
Plaintext
Raw Normal View History

2025-07-31 20:12:01 +08:00
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:cvt="clr-namespace:LucentUI.Converters"
xmlns:cvte="clr-namespace:LucentUI.Converters.Emboss"
xmlns:svd="clr-namespace:LucentUI.Controls.Decorations"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
2025-07-11 09:20:23 +08:00
<Style TargetType="{x:Type svd:EmbossBorder}">
<Setter Property="Focusable" Value="False" />
<Setter Property="CornerRadius" Value="4" />
<Setter Property="Background" Value="{StaticResource Background.Main}" />
<Setter Property="Foreground" Value="{StaticResource Text.Main}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Intensity" Value="1" />
2025-07-31 20:12:01 +08:00
<Setter Property="Brush" Value="{StaticResource Shader}" />
2025-07-11 09:20:23 +08:00
<Setter Property="ShadowBrush" Value="{StaticResource Shader.Shadow}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type svd:EmbossBorder}">
<ControlTemplate.Resources>
2025-07-31 20:12:01 +08:00
<cvte:IntensityToMarginLeftTopConverter x:Key="IntensityToMarginLeftTop" />
<cvte:IntensityToMarginRightBottomConverter x:Key="IntensityToMarginRightBottom" />
<cvte:IntensityToBlurConverter x:Key="IntensityToBlur" />
<cvt:BoolToVisibilityConverter x:Key="BoolToVisibility" />
2025-07-11 09:20:23 +08:00
</ControlTemplate.Resources>
<Grid>
2025-07-31 20:12:01 +08:00
<!-- 光影区域 -->
<Grid Margin="4" Visibility="{TemplateBinding ShaderEnabled, Converter={StaticResource BoolToVisibility}}">
<!-- 暗部 -->
<Border
Background="{TemplateBinding ShadowBrush}"
CornerRadius="{TemplateBinding CornerRadius}"
Margin="{TemplateBinding Intensity,
Converter={StaticResource IntensityToMarginRightBottom}}" />
<!-- 亮部 -->
<Border
Background="{TemplateBinding Brush}"
CornerRadius="{TemplateBinding CornerRadius}"
Margin="{TemplateBinding Intensity,
Converter={StaticResource IntensityToMarginLeftTop}}" />
<!-- 模糊效果 -->
2025-07-11 09:20:23 +08:00
<Grid.Effect>
2025-07-31 20:12:01 +08:00
<BlurEffect Radius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Intensity, Converter={StaticResource IntensityToBlur}, Mode=OneWay}" />
2025-07-11 09:20:23 +08:00
</Grid.Effect>
</Grid>
2025-07-31 20:12:01 +08:00
<!-- 内容区域 -->
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Margin="4">
<ContentPresenter
Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
TextElement.Foreground="{TemplateBinding Foreground}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="contentPresenter" />
2025-07-11 09:20:23 +08:00
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>