Mega Code Archive

 
Categories / Silverlight / Graphics
 

Fill Rectangle with Gradient color

<UserControl x:Class="SilverlightApplication3.MainPage"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"      Width="800" Height="600">   <Canvas x:Name="LayoutRoot" Background="White" >         <Rectangle Height="100"               Width="250"               Fill="Red"               StrokeThickness="20">             <Rectangle.Stroke>                 <LinearGradientBrush>                     <GradientStop Color="Orange" Offset="0.0" />                     <GradientStop Color="Yellow" Offset="0.5" />                     <GradientStop Color="Red" Offset="1.0" />                 </LinearGradientBrush>             </Rectangle.Stroke>         </Rectangle>   </Canvas> </UserControl>