--- title: "How to: Paint an Area with a Radial Gradient" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "brushes [WPF], painting with radial gradients" - "radial gradients [WPF], painting with" - "painting [WPF], with radial gradients" ms.assetid: b5d0fc8a-8986-4796-b003-a75b41a48928 --- # How to: Paint an Area with a Radial Gradient This example shows how to use the class to paint an area with a radial gradient. ## Example The following example uses a to paint a rectangle with a radial gradient that transitions from yellow to red to blue to lime green. [!code-csharp[BrushesIntroduction_snip#SimpleRadialGradientExampleWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/BrushesIntroduction_snip/CSharp/RadialGradientBrushSnippet.cs#simpleradialgradientexamplewholepage)] [!code-vb[BrushesIntroduction_snip#SimpleRadialGradientExampleWholePage](~/samples/snippets/visualbasic/VS_Snippets_Wpf/BrushesIntroduction_snip/visualbasic/radialgradientbrushsnippet.vb#simpleradialgradientexamplewholepage)] [!code-xaml[BrushesIntroduction_snip#SimpleRadialGradientExampleWholePage](~/samples/snippets/xaml/VS_Snippets_Wpf/BrushesIntroduction_snip/XAML/RadialGradientBrushSnippet.xaml#simpleradialgradientexamplewholepage)] The following illustration shows the gradient from the preceding example. The gradient's stops have been highlighted. ![Gradient stops in a radial gradient](./media/wcpsdk-graphicsmm-4gradientstops-rg.png "wcpsdk_graphicsmm_4gradientstops_rg") > [!NOTE] > The examples in this topic use the default coordinate system for setting control points. The default coordinate system is relative to a bounding box: 0 indicates 0 percent of the bounding box, and 1 indicates 100 percent of the bounding box. You can change this coordinate system by setting the property to the value . An absolute coordinate system is not relative to a bounding box. Values are interpreted directly in local space. For additional examples, see the [Brushes Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Graphics/Brushes). For more information about gradients and other types of brushes, see [Painting with Solid Colors and Gradients Overview](painting-with-solid-colors-and-gradients-overview.md).