Bitmap Effects In WPF - Part II

Drop Shadow Bitmap Effect

This Bitmap Effect created a shadow behind the object.

This effect is best suited for Panels like Borders, TreeView, ListBox etc…

Let's add some controls like those and see the difference.

The problem with effects is whenever a parent is given an effect the children would also inherit from it. Until and unless we define explicitly effects for each child, this is not good.

Clipboard01.gif

Clipboard02.gif

As you see above the children are also having the same effect applied to parent Border.

There is only one work around for this, let's say you have the Border with effect. Just have another border with same position but without the effect, that would resolve the problem.

See below image:

Clipboard03.gif

For DropShadow BitmapEffect we have properties like Color, ShadowDepth, Direction.

Direction is the property which decides which direction you want the shadow. It's basically the angle of X axis, so you can rotate your angle based on your choice.

Clipboard04.gif

As you see the above image we have set the Direction to 180.

Bevel Bitmap Effect

This effect creates a bevel which raises the surface of an image according to a specified curve.

As said above, it is best suited for Images, though it can be applied to any control.

Clipboard05.gif

As you see above we have effect best visible for images. The left image is with Bevel Bitmap Effect and the right image is without any effect.

This effect has properties like BevelWidth and EdgeProfile.

Clipboard06.gif

Edge Profile has four different types.

Emboss Bitmap Effect

This bitmap Effect creates a bump mapping of a Visual to give the impression of depth and texture from an artificial light source.

Again this effect is best suited for Images.

Clipboard07.gif

As you see above the left image is having the Emboss effect and the right side image is without any effect.

This effect has two properties as LightAngle and Relief.

If Relief is not used the image would be darkened.

Hope this article helps.

Up Next
    Ebook Download
    View all
    Learn
    View all