【发布时间】:2019-01-10 13:12:17
【问题描述】:
我想要的是仅来自按钮边框外部的阴影,而没有来自内部的阴影。有没有办法在按钮样式中做到这一点?
https://stackoverflow.com/a/11124369/7402089
找到了我需要的东西,但阴影来自边界内外。
我试图在DropShadowEffect 属性和Border 属性中搜索或在互联网上搜索,但我没有找到任何东西。
<Style x:Key="GlowingBorder" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Margin="10" Background="Transparent"
BorderBrush="#171e25" BorderThickness="1" Opacity="1.0"
CornerRadius="{TemplateBinding Border.CornerRadius}">
<Border.Effect>
<DropShadowEffect ShadowDepth="0"
Color="#72f4aa"
Opacity="1"
BlurRadius="6"/>
</Border.Effect>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
预期:来自外部的阴影,没有来自边界内部的阴影。带有边框颜色的填充按钮。
当前结果:来自边界内外的阴影。 Foreground 和 Background 内的 Style 属性无效,按钮的 Context 也不显示。不知道为什么。
我该如何解决?
【问题讨论】: