Applying a SolidColorBrush

The System.Windows.Media.SolidColorBrush object enables you to fill an object with a single color. The color is applied to the Fill property of geometric shapes and to the Background or Foreground properties in UI controls. The following code demonstrates how to apply a SolidColorBrush:

<Rectangle Grid.Row="0" Width="200" Margin="5">    <Rectangle.Fill>        <SolidColorBrush Color="Red"/>    </Rectangle.Fill></Rectangle>

The Color property receives a value of type System.Windows.Media.Color. Colors are exposed by the System.Windows.Media.Colors class as shared properties. The result of this color brush is shown in Figure 30.1.

FIGURE 30.1 Applying a SolidColorBrush.

Applying a color ...

Get Visual Basic 2015 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.