Monday, April 21, 2008 2:16 PM
Tim Rule
Drop Shadow Effect for Silverlight 2 Beta 2
A configurable shadow effect can be achieved for Silverlight 2 Beta 1 with the use of the Grid control and gradient fills. This will work for rectangular and rounded rectangular content. The code is built off of the previous glow effect post.
The ShadowBox like thee GlowBox control is composed of a Canvas containing a Grid which is used to build the glow and a ContentPresenter.

The grid contains 8 rectangles with linear or radial gradients. The gradient stop is adjusted to achieve varying degrees of rounding. The shadow is then offset via a Distance and Angle property.
With the glow the gradients radiate from a base shape equal to that of the content. With the shadow the size of the base shape decreases as the spread increases to simulate the effect of a softer light.
The lastest code for this effect can be found in the InnerGlow Post.