Color Brushes

The three color brushes are SolidColorBrush, LinearGradientBrush, and RadialGradientBrush. The last one is WPF- and Silverlight-specific. These brushes sound straightforward, but they are more flexible than most people realize.

SolidColorBrush

SolidColorBrush, used implicitly throughout this book, fills the target area with a single color. It has a simple Color property of type Color. Color exposes four Byte properties (one per channel): A for alpha, R for red, G for green, and B for blue. Because of the syntax that treats strings such as “Blue” or “#FFFFFF” as SolidColorBrushes, they are indistinguishable from their underlying Color in XAML. In fact, color strings can take one of three different forms in XAML:

A name, like ...

Get XAML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.