原文 http://blog.csdn.net/a771948524/article/details/9259557html
1.首先最多見的一個陰影效果的類是DropShadowEffect。它有幾種比較有用的屬性好比:Color設置顏色,Direction設置投影的方向,ShadowDepth設置投影距紋理下方的距離,Opacity設置透明度等等。角度的設置是這樣的:windows

下面是一個例子和效果:ui
- <TextBlock Text="HELLO WORLD" Foreground="Green" HorizontalAlignment="Center" Margin="20" FontSize="36">
- <TextBlock.Effect>
- <DropShadowEffect Color="Black" Direction="0" ShadowDepth="5" Opacity="1" />
- </TextBlock.Effect>
- </TextBlock>

2.接下來是模糊效果的類BlurEffect。能夠設置Radius模糊效果曲線的半徑,KernelType計算模糊的曲線的值等等。spa
- <TextBlock Text="Hello world" Foreground="Green" HorizontalAlignment="Center" Margin="20" FontSize="36">
- <TextBlock.Effect>
- <BlurEffect Radius="4" KernelType="Box" />
- </TextBlock.Effect>
- </TextBlock>

3.好吧貌似沒撒能用的了,不過還能夠用TranslateTransform來疊兩個一樣的東西來顯示弄出陰影效果。.net
- <Grid>
- <TextBlock Text="helloworld" Foreground="Black" HorizontalAlignment="Center" Margin="20" FontSize="36">
- <TextBlock.RenderTransform>
- <TranslateTransform X="3" Y="3" />
- </TextBlock.RenderTransform>
- </TextBlock>
- <TextBlock Text="helloworld" Foreground="Green" HorizontalAlignment="Center" Margin="20" FontSize="36" />
-
- </Grid>

4.最後弄張相框類型的陰影圖片來玩玩。orm
- <Border SnapsToDevicePixels="True" BorderBrush="Red" BorderThickness="4" CornerRadius="5" Margin="20" HorizontalAlignment="Center" VerticalAlignment="Center">
- <Image Width="200" Source="C:\Users\lenovo\Downloads\1.jpg" Stretch="Uniform" />
- <Border.Effect>
- <DropShadowEffect Color="Black" BlurRadius="16" ShadowDepth="0" Opacity="1" />
- </Border.Effect>
- </Border>