WPF中的模糊、阴影效果

  <Window x:Class="项目10.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
          xmlns:sys="clr-namespace:System;assembly=mscorlib"
          xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
          xmlns:local="clr-namespace:项目10"
          mc:Ignorable="d"
          Title="MainWindow" Width="500" Height="350"  WindowStartupLocation="CenterScreen">
      <StackPanel Margin="25">
          <TextBlock FontSize="20" Margin="5">
              <TextBlock.Effect>
                  <DropShadowEffect></DropShadowEffect>
              </TextBlock.Effect>
              Basic dropshadow
          </TextBlock>
          <TextBlock FontSize="20" Margin="5">
              <TextBlock.Effect>
                  <DropShadowEffect Color="Blue"></DropShadowEffect>
              </TextBlock.Effect>
              Blue dropshadow
          </TextBlock>
          <TextBlock FontSize="20" Margin="5">
              <TextBlock.Effect>
                  <DropShadowEffect Color="Blue" BlurRadius="3"></DropShadowEffect>
              </TextBlock.Effect>
              BlurRadius=3 dropshadow
          </TextBlock>
          <TextBlock FontSize="20" Margin="5">
              <TextBlock.Effect>
                  <DropShadowEffect Color="Blue" BlurRadius="3" ShadowDepth="9"></DropShadowEffect>
              </TextBlock.Effect>
              ShadowDepth="6" dropshadow
          </TextBlock>
          <TextBlock FontSize="20" Margin="5">
              <TextBlock.Effect>
                  <DropShadowEffect Color="Blue" BlurRadius="3" ShadowDepth="6"
                                    Opacity="0.3"></DropShadowEffect>
              </TextBlock.Effect>
              Opacity="0.3" dropshadow
          </TextBlock>
          <TextBlock FontSize="20" Margin="5">
              <TextBlock.Effect>
                  <DropShadowEffect Color="Blue" BlurRadius="3" ShadowDepth="6"
                                    Opacity="0.3" Direction="45"></DropShadowEffect>
              </TextBlock.Effect>
              Direction="45" dropshadow
          </TextBlock>
      </StackPanel>
  </Window>

  using System;
  using System.Windows;
  using System.Windows.Media;
  using System.Windows.Media.Effects;
  using System.Reflection;

  namespace 项目10 {

      public class ThresholdEffect : ShaderEffect {
          private static PixelShader _pixelShader =
              new PixelShader() { UriSource = MakePackUri("ThresholdEffect.fx.ps") };

          public ThresholdEffect()
          {
              PixelShader = _pixelShader;

              UpdateShaderValue(InputProperty);
              UpdateShaderValue(ThresholdProperty);
              UpdateShaderValue(BlankColorProperty);
          }

          // MakePackUri is a utility method for computing a pack uri
          // for the given resource.
          public static Uri MakePackUri(string relativeFile)
          {
              Assembly a = typeof(ThresholdEffect).Assembly;

              // Extract the short name.
              string assemblyShortName = a.ToString().Split(',')[0];

              string uriString = "pack://application:,,,/" +
                  assemblyShortName +
                  ";component/" +
                  relativeFile;

              return new Uri(uriString);
          }

          ///////////////////////////////////////////////////////////////////////
          #region Input dependency property

          public Brush Input {
              get { return (Brush)GetValue(InputProperty); }
              set { SetValue(InputProperty, value); }
          }

          public static readonly DependencyProperty InputProperty =
              ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(ThresholdEffect), 0);

          #endregion

          ///////////////////////////////////////////////////////////////////////
          #region Threshold dependency property

          public double Threshold {
              get { return (double)GetValue(ThresholdProperty); }
              set { SetValue(ThresholdProperty, value); }
          }

          public static readonly DependencyProperty ThresholdProperty =
              DependencyProperty.Register("Threshold", typeof(double), typeof(ThresholdEffect),
                      new UIPropertyMetadata(0.5, PixelShaderConstantCallback(0)));

          #endregion

          ///////////////////////////////////////////////////////////////////////
          #region BlankColor dependency property

          public Color BlankColor {
              get { return (Color)GetValue(BlankColorProperty); }
              set { SetValue(BlankColorProperty, value); }
          }

          public static readonly DependencyProperty BlankColorProperty =
              DependencyProperty.Register("BlankColor", typeof(Color), typeof(ThresholdEffect),
                      new UIPropertyMetadata(Colors.Transparent, PixelShaderConstantCallback(1)));

          #endregion
      }
  }
<Window.Resources>
	<local:ThresholdEffect x:Key="thresholdEffect" Threshold="0.25" BlankColor="Orange" />
</Window.Resources>
<Grid Effect="{StaticResource thresholdEffect}">

</Grid>