Use GradientStopCollection to group Gradient stops : GradientStopCollection « Graphics « Silverlight






Use GradientStopCollection to group Gradient stops

  
<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>
        <LinearGradientBrush GradientStops="{StaticResource myGradientStops}">
          <LinearGradientBrush.Transform>
            <RotateTransform CenterX="87.5" CenterY="45" Angle="45" />
          </LinearGradientBrush.Transform>
        </LinearGradientBrush>
      </Rectangle.Fill>
    </Rectangle>

</UserControl>

   
    
  








Related examples in the same category