views:

252

answers:

2

I want to give a blur effect to my DrawingVisual. I can do this using BitmapEffect properties like:

DrawingVisual drawingVisual = new DrawingVisual();
DrawingContext drawingContext = drawingVisual.RenderOpen();
var effect = new System.Windows.Media.Effects.BlurBitmapEffect();
effect.Radius = 10;
drawingVisual.BitmapEffect = effect;

But the compiler give me a warning that Bitmap effect properties is obsolete.

What other alternative I can use to achive the effect on DrawingVisual?

+1  A: 

DrawingVisuals do not yet support the new Effect methodology that uses pixel shaders (the built-in BlurEffect is what you should be using). You can either wait until they do, or you can workaround it by rendering your visuals into an Image of some sort and using the Image.Effect property.

Charlie
+1  A: 

Effect property of DrawingVisual in not support in 3.5SP1 but there is another way to achieve this to apply shader effect to visual. Here is the example how we can apply shader effect to DrawingVisual

Firoz