views:

522

answers:

2

I have a XAML TextBlock that I would like to render as a drop shadow. That is a white layer of text on top of a black layer. I'm doing this to make the text stand. Currently I have two TextBlocks offset to the right and below by two pixels. The top layer is white and the bottom layer is black.

Is there a simple way to do this in XAML? If so can you please provide an example?

+1  A: 
<TextBlock
 Text="Shadow Text"
 Foreground="Teal">
<TextBlock.BitmapEffect>
<DropShadowBitmapEffect
  ShadowDepth="4"
  Direction="330"
  Color="Black"
  Opacity="0.5"
  Softness="0.25" />
</TextBlock.BitmapEffect>
</TextBlock>

There are plenty of other examples on MSDN

Brandon
Very nice - tnx
Kevin
+2  A: 

Bitmap effects are deprecated. Use the new GPU-accelerated DropShadowEffect instead.

<TextBlock>
    <TextBlock.Effect>
        <DropShadowEffect />
    </TextBlock.Effect>
    Drop.
</TextBlock>
Will