功能更新
This commit is contained in:
70
Melskin/Controls/Decorations/EmbossBorder.xaml
Normal file
70
Melskin/Controls/Decorations/EmbossBorder.xaml
Normal file
@@ -0,0 +1,70 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:cvt="clr-namespace:Melskin.Converters"
|
||||
xmlns:decorations="clr-namespace:Melskin.Controls.Decorations"
|
||||
xmlns:internal="clr-namespace:Melskin.Converters.Internal"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style TargetType="{x:Type decorations:EmbossBorder}">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="CornerRadius" Value="4" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="Padding" Value="4" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="Intensity" Value="1" />
|
||||
<Setter Property="LightShadowBrush" Value="{DynamicResource LightShadowBrush}" />
|
||||
<Setter Property="DarkShadowBrush" Value="{DynamicResource DarkShadowBrush}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type decorations:EmbossBorder}">
|
||||
<Grid>
|
||||
<!-- 光影区域 -->
|
||||
<!-- 默认4的边距显示光影效果 -->
|
||||
<Grid Margin="4" Visibility="{TemplateBinding ShaderEnabled, Converter={x:Static cvt:BooleanToVisibilityConverter.CollapsedInstance}}">
|
||||
<!-- 暗部 -->
|
||||
<Border
|
||||
Background="{TemplateBinding DarkShadowBrush}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Margin="{TemplateBinding Intensity,
|
||||
Converter={x:Static internal:IntensityToEmbossMarginRightBottomConverter.Instance}}"
|
||||
x:Name="DarkBorder" />
|
||||
<!-- 亮部 -->
|
||||
<Border
|
||||
Background="{TemplateBinding LightShadowBrush}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Margin="{TemplateBinding Intensity,
|
||||
Converter={x:Static internal:IntensityToEmbossMarginLeftTopConverter.Instance}}" />
|
||||
<!-- 模糊效果 -->
|
||||
<Grid.Effect>
|
||||
<BlurEffect Radius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Intensity, Converter={x:Static internal:IntensityToEmbossBlurConverter.Instance}, Mode=OneWay}" />
|
||||
</Grid.Effect>
|
||||
</Grid>
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<!-- 默认4的边距显示光影效果 -->
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Margin="4"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter
|
||||
Focusable="False"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
TextElement.Foreground="{TemplateBinding Foreground}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="contentPresenter" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user