In order to introduce glow effect all we need to do is to use DropShadowEffect with ShadowDepth set to zero. For ex. let us look at the code below for a Rectangle.

<Rectangle Height=”100″ Width=”100″ Stroke=”PeachPuff” RadiusX=”5″ RadiusY=”5″ StrokeThickness=”3″ x:Name=”Rect1″ Opacity=”1.0″>
<DropShadowEffect BlurRadius=”20″
Direction=”0″ />

Notice Opacity set to 1.0. In order to change the glow effect you need to set opacity value to zer0 which will remove the glow effect (see below)

So how do we set the Opacity value to zero programmatically? Well, one line of code is all we need.

Rect1.Effect.SetValue(DropShadowEffect.OpacityProperty, 0.0);

You want to turn it back on, set the value to 1.

Rect1.Effect.SetValue(DropShadowEffect.OpacityProperty, 1.0);

Turn glow effect on and off in Silverlight

Leave a Reply

Your email address will not be published. Required fields are marked *