How to a Rectangle Style

951
2
04-09-2010 10:39 AM
DonFreeman
New Contributor
Hi there -
Can someone help me convert this rectangle into a Style? The dual GradientStop properties make it somewhat confusing.
Thanks
 <Rectangle Margin="0,0,0,0">
  <Rectangle.Fill>
   <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
    <GradientStop Color="DarkBlue" Offset="0.3" />
    <GradientStop Color="SlateBlue" Offset="0.7" />
   </LinearGradientBrush>
  </Rectangle.Fill>
 </Rectangle>
0 Kudos
2 Replies
dotMorten_esri
Esri Notable Contributor
 
<Grid.Resources>
   <Style x:Key="myRectangleStyle" TargetType="Rectangle">
       <Setter Property="Margin" Value="0,0,0,0" />
       <Setter Property="Fill">
           <Setter.Value>
             <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
               <GradientStop Color="DarkBlue" Offset="0.3" />
               <GradientStop Color="SlateBlue" Offset="0.7" />
             </LinearGradientBrush>
           </Setter.Value>
       </Setter>
  </Style>
</Grid.Resources>
<Rectangle Style="{StaticResource myRectangleStyle} />
0 Kudos
DonFreeman
New Contributor
Cool! Thanks for the clarification.
0 Kudos