May 17, 2012 Leave a comment
You can use a radial gradient in WPF to create a 3D effect on a shape. In the example below, we set up a gradient on a circle (Ellipse shape) to make the circle look like a 3D sphere.
Start by drawing a simple circle (Ellipse).
Now specify a radial gradient for the Fill property.
Next, click on the Gradient tool and then slide the radial gradient off-center, relative to the ellipse.
Finally, adjust the gradient so that the center starts out white and fades to a darker color at the edge of the gradient. You can also enlarge the gradient so that its outer edge lines up with the outer edge of the ellipse.
Here’s the final result: