[英]WPF DropShadow Effect disapear when setting background color of control
在这个例子中,我有一个带有DropShadowEffect
的TextBlock
:
<TextBlock Foreground="Black" Text="All Tasks">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="1.2"
Direction="270"
Opacity="0.6"
BlurRadius="1"
Color="Red"/>
</TextBlock.Effect>
</TextBlock>
这将产生以下输出:
如果我为TextBlock
设置了任何背景色,则阴影应消失:
如何在保持阴影的同时设置此属性?
DropShadowEffect
不会消失-它现在适用于整个矩形。
这样可以达到预期的效果:
<Border Background="Green">
<TextBlock Foreground="Black" Text="All Tasks">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="1.2"
Direction="270"
Opacity="0.6"
BlurRadius="1"
Color="Red"/>
</TextBlock.Effect>
</TextBlock>
</Border>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.