Mega Code Archive

 
Categories / Silverlight / Graphics
 

RadialGradientBrush examples and Define GradientStop in Resource

<UserControl x:Class='SilverlightApplication3.MainPage'     xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'      xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'     xmlns:d='http://schemas.microsoft.com/expression/blend/2008'      xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006'      mc:Ignorable='d'      d:DesignWidth='640'      d:DesignHeight='480'>     <UserControl.Resources>     <GradientStopCollection x:Key="myGradientStops">       <GradientStop Offset="0.0" Color="Blue" />       <GradientStop Offset="0.4" Color="Black" />       <GradientStop Offset="0.5" Color="White" />       <GradientStop Offset="0.6" Color="Black" />       <GradientStop Offset="0.7" Color="Blue" />     </GradientStopCollection>          </UserControl.Resources>     <Rectangle Width="175" Height="90" Stroke="Black">       <Rectangle.Fill>         <RadialGradientBrush GradientStops="{StaticResource myGradientStops}"></RadialGradientBrush>       </Rectangle.Fill>     </Rectangle> </UserControl>