我已经设计了一个HTML界面,并希望将其转换为WPF,但是我遇到了插入阴影的麻烦。
box-shadow: inset 0 2px 7px 0 rgba(0, 0, 0, 0.5);
我正在寻找的效果是jsFiddle,我该如何将其完全翻译成WPF?
更新
我目前基于理查兹的答案如下,但它仍然没有出现阴影?
<Border Grid.Row="1" CornerRadius="3" Grid.Column="0" Margin="13,0,12,0" BorderThickness="0" BorderBrush="#d2d2d2" ClipToBounds="True" Background="#fff0f0f0" >
<Border Background="Transparent" BorderBrush="Black" CornerRadius="3" BorderThickness="0" Margin="0">
<Border.Effect>
<DropShadowEffect ShadowDepth="2" BlurRadius="7" Color="Black" Direction="270" Opacity="0.5"/>
</Border.Effect>
</Border>
</Border>
答案 0 :(得分:17)
您可以尝试这样的方法,相应地调整厚度:
<Border Background="LightGray" BorderBrush="DarkGray"
BorderThickness="1" ClipToBounds="True">
<Border Background="Transparent" BorderBrush="Black"
BorderThickness="0 2 7 0" Margin="-2">
<Border.Effect>
<DropShadowEffect ShadowDepth="0" BlurRadius="10"/>
</Border.Effect>
</Border>
</Border>