WPF - How to add effects (e.g. Shadow) to a shortcut

I have a tag and want to add Shadow to it.

It looks like I can't apply DropShadowBitmapEffect to it.

What else can I do?

+6
c # visual-studio wpf
source share
3 answers

You can do this for an example:

<Label Content="LabelText:" > <Label.BitmapEffect> <DropShadowBitmapEffect Color="Black" Direction="320" ShadowDepth="10" Opacity=".5" Softness="9" /> </Label.BitmapEffect> </Label> 
+6
source share

Raster effects are deprecated with .NET 3.5 (SP1?). Use DropShadowEffect instead .

EDIT: since the effects have been deprecated for a while, in .NET 4.0 they are an empty block of code, i.e. do nothing.

+5
source share

Use DropShadowEffect instead of DropShadowBitmapEffect . Raster effects are outdated. But be careful with the effects. Use the WPF Performance Suite to test the effectiveness of the behavior of the effects used - I have already seen very bad performance consequences using the effect classes. See here for an example.

Another option is to decorate the Border shortcut. If you set the thickness accordingly, it will look like a shadow:

 <Border BorderThickness="1,1,20,20" BorderBrush="Black"> <Label /> </Border> 

(I did not see what the above border looks like. You need to play a little to get a good result).

+4
source share

All Articles