<LinearGradientBrush StartPoint="0,0" EndPoint="5,5" <LinearGradientBrush.GradientStops> <GradientStop Color="Yellow" Offset="0" /> <GradientStop Color="Green" Offset="0.5" /> </LinearGradientBrush.GradientStops> </LinearGradientBrush> or: <LinearGradientBrush> <LinearGradientBrush.StartPoint> <Point X="0" Y="0" /> </LinearGradientBrush.StartPoint> <LinearGradientBrush.EndPoint> <Point X="5" Y="5" /> </LinearGradientBrush.EndPoint> <LinearGradientBrush.GradientStops> <GradientStop Color="Yellow" Offset="0" /> <GradientStop Color="Green" Offset="0.5" /> </LinearGradientBrush.GradientStops> </LinearGradientBrush> <LinearGradientBrush .../> paints an area with a linear gradient. Colors in the gradient are interpolated along a diagonal path. LinearGradientBrush can be specified as an attribute on XAML elements using abbreviated markup syntax (Example 7-3). Figure 7-6 shows an example of using a LinearGradientBrush to paint a Rectangle element. Figure 7-6. Painting a Rectangle with a LinearGradientBrushAttributes
Figure 7-7. Example of Horizontal and Vertical linear gradient brushes |