Files
docs-desktop/dotnet-desktop-guide/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-radial-gradient.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

2.5 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Paint an Area with a Radial Gradient 03/30/2017
csharp
vb
brushes [WPF], painting with radial gradients
radial gradients [WPF], painting with
painting [WPF], with radial gradients
b5d0fc8a-8986-4796-b003-a75b41a48928

How to: Paint an Area with a Radial Gradient

This example shows how to use the xref:System.Windows.Media.RadialGradientBrush class to paint an area with a radial gradient.

Example

The following example uses a xref:System.Windows.Media.RadialGradientBrush to paint a rectangle with a radial gradient that transitions from yellow to red to blue to lime green.

[!code-csharpBrushesIntroduction_snip#SimpleRadialGradientExampleWholePage] [!code-vbBrushesIntroduction_snip#SimpleRadialGradientExampleWholePage] [!code-xamlBrushesIntroduction_snip#SimpleRadialGradientExampleWholePage]

The following illustration shows the gradient from the preceding example. The gradient's stops have been highlighted.

Gradient stops in a radial gradient

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 xref:System.Windows.Media.GradientBrush.MappingMode%2A property to the value xref:System.Windows.Media.BrushMappingMode.Absolute. An absolute coordinate system is not relative to a bounding box. Values are interpreted directly in local space.

For additional xref:System.Windows.Media.RadialGradientBrush examples, see the Brushes Sample. For more information about gradients and other types of brushes, see Painting with Solid Colors and Gradients Overview.