Bitmap Effects In WPF - Part II
In previous article we saw how we can add effects; we experienced Blur and Outer Glow Bitmap effects. In this article we will see rest of the 3 Bitmap Effects.
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.
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:
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.
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.
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.
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.
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.