Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

O'Reilly Media, Inc. 4/5/2012 </CheckBox> There are tradeoffs in shaders, just as in other areas of programming. Blur algorithms can affect rendering speed so the WPF BlurEffect provides the RenderingBias property as a means to choose performance or quality output for the effect. To get better quality output alter the property as shown in Example 4-2. DropShadowEffect The UI design community has a turbulent relationship with the drop shadow. One decade it's a beloved tool in UI design and it pervades the popular design metaphors and the next it isn't. Designers are restless and inquisitive and eventually the drop shadow falls from favor and is viewed as an anachronism by the same community. If you long to add a shadowy aspect to your UI, reach for the DropShadowEffect class. The Silverlight version contains a few properties that are self-explanatory (Color, Opacity and ShadowDepth) so I won't burden you with a description. The Direction property represents the angled direction of the shadow. A direction of zero draws a shadow to the right of the host element. Higher values rotate the shadow counterclockwise with the default value (315) placing the shadow in the lower right position. The BlurRadius property configures the blurriness of the shadow. Set the BlurRadius to zero and the shadow has a crisp, sharp edge, crank up the value for maximum shadow fuzziness. WPF adds one additional property, RenderingBias, over the Silverlight version, which provides the same services as seen in the BlurEffect.RenderingBias property described earlier. Nested Effects When an effect is applied to a framework element, it affects that element and all of its children. In many circumstances, this is the appropriate approach and the UI looks as expected. Other times the nested effects give an undesirable look to the UI. Figure 4-2 shows two stack panels with a drop shadow applied. The first stack panel has the desired look, because its background brush is fully opaque. The second stack panel uses a solid color background brush with the alpha channel set to a non-opaque value. Because the brush is semi-transparent the drop shadows for the child elements are visible. 3