Chapter 19. Colors and Brushes

What You’ll Learn in This Hour:

  • Defining colors

  • Defining brushes

  • Different types of brushes

  • Using colors and brushes

Colors and brushes are at the core of WPF. You can find them in almost every part of the API. Thus far, we have been glossing over them, allowing you to understand them on a mostly intuitive level. However, we now examine them more fully to take further advantage of WPF’s powerful features.

Using Colors

We’ve been using colors from the very beginning of this book, but we first drew attention to them in Hour 14, “Resources and Styles,” when we introduced resources. Here’s what we showed:

<Color x:Key="lightBlueColor">#FF145E9D</Color>
<Color x:Key="darkBlueColor">#FF022D51</Color>
<Color x:Key="redColor">

Get Sams Teach Yourself WPF in 24 Hours 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.