Appendix G. Brushes

This appendix summarizes brushes. A Brush defines the colors used to fill an area such as a Rectangle or Ellipse. Brushes also define the colors used by many controls' Foreground and Background properties.

The following section briefly describes each of the types of Brushes available. The sections that follow describe each of the Brush types in greater detail.

Brush Classes

Table G-1 summarizes the Brush classes.

Table G.1. Classes of Brush

Brush Class



Fills areas with a drawing.


Fills areas with one or more copies of an image.


Fills areas with a color gradient that shades between two or more colors in a linear direction.


Fills areas with a color gradient that shades between two or more colors radially.


Fills areas with a solid color.


Fills areas with a visual. (Loosely speaking, a visual is an object that provides rendering support for WPF. It's basically something that can draw itself such as a control.)

The Brushes example program shown in Figure G-1 demonstrates these kinds of brushes. The SolidColorBrush fills its Ellipse with dark gray, the LinearGradientBrush shades from white at the top to black at the bottom, and the RadialGradientBrush shades from white at the middle to black at the edges.

Figure G-1

Figure G.1. Figure G-1


A DrawingBrush fills areas with a Drawing object. ...

Get WPF Programmer's Reference: Windows Presentation Foundation with C# 2010 and .NET 4 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.