我想动态地将DropShadowEffect添加到我的Silverlight边框,但是无法弄清楚C#语法......
<Border BorderThickness="1"
CornerRadius="5"
Background="{StaticResource PanelBackground}"
BorderBrush="{StaticResource PanelBorderBrush}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="0,8,0,0"
Width="250">
<Border.Effect>
<DropShadowEffect />
</Border.Effect>
</Border>
我可以创建边框很好的边框。影响我遇到了麻烦。
保罗。
答案 0 :(得分:4)
System.Windows.Media.Effects.DropShadowEffect dropShadowEffect = new System.Windows.Media.Effects.DropShadowEffect();
dropShadowEffect.Opacity = 0.25;
dropShadowEffect.ShadowDepth = 5;
dropShadowEffect.BlurRadius = 10;
dropShadowEffect.Color = Colors.Black;
this.image.Effect = dropShadowEffect;
来源http://msdn.microsoft.com/en-us/library/system.windows.media.effects.dropshadoweffect.aspx
和
<Border Name="border">
<Border.Effect>
<DropShadowEffect/>
</Border.Effect>
</Border>
this.border.Effect = dropShadowEffect;