We pay for user submitted tutorials and articles that we publish. Anyone can send in a contributionLearn More
Many times I want to make my WPF Controls have a 3D effect. For examples Headers of lists and such. Saddly there is no built in way to do it so we have to come up with a custom solution. I don’t want to use Bitmap effects due to performance reasons, I must say I don’t have much experience with them but from what I have I am not a big fan.
Here is my solution for a 3D effect on WPF Controls.
First of all a Quick demonstration. Which one looks better.
I don’t know about you but the second one is much nicer with that 3D effect.
How is it done? As I said before I don’t like using Bitmap effects if I don’t have to, so this is done with combining 2 borders together. The simple upper one is a regular border with TextBlock
To create the 3D effect I wrapped the TextBlock with 2 borders one White and one Black and set the their with so the white Border is visible on top and the black Border is visible at the bottom.
Here is the code:
Easy isn’t it? No Bitmap effects, only standard controls. You can easily customize the look and feel of it by changing colors and rounding the corners
Tags :3D borderbitmap effectcontrolStyleWPF
Copyright © 2012 Dev102.com
Breeze : Designed by Amit Raz and Nitzan Kupererd