Silverlight Linear Gradient Brush in VB.NET
Linear Gradient Brush is used to paint an area with linear gradient.
The LinearGradientBrush paints an area intelligently, so you can feel colors. In this example, I am painting a Grid and a Rectangle using LinearGradientBrush in Silverlight.
When you define LinearGradientBrush you need to specify the StartPoint and EndPoint.
XAML to paint the Rectangle -
<Rectangle Width="200" Height=" 150" VerticalAlignment="Center">
<Rectangle.Fill>
<LinearGradientBrush StartPoint=" 0,0" EndPoint=" 1,1">
<GradientStop Offset="0" Color="Blue" />
<GradientStop Offset="0.25" Color="Red" />
<GradientStop Offset="0.5" Color="Cyan" />
<GradientStop Offset="0.75" Color="Azure" />
<GradientStop Offset="1" Color="BurlyWood" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
How it works?
Output
XAML to paint the Grid -
<Grid Width="200" Height=" 150" VerticalAlignment="Center">
<Grid.Background >
<LinearGradientBrush StartPoint="0.5,0" EndPoint=" 0.5,1">
<GradientStop Offset="0" Color="Blue" />
<GradientStop Offset="0.25" Color="Red" />
<GradientStop Offset="0.5" Color="Cyan" />
<GradientStop Offset="0.75" Color="Azure" />
<GradientStop Offset="1" Color="BurlyWood" />
</LinearGradientBrush>
</Grid.Background>
</Grid>
How it works?
Output