CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: XML

Shimmer and Shine with WPF4 (and SL)

476 Views
Copy Code Show/Hide Line Numbers
<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Jerry Nixon">
  <Page.Resources>
 
   <Style TargetType="Border" x:Key="BorderStyle">
    <Setter Property="Margin" Value="10" />
    <Setter Property="Padding" Value="10" />
    <Setter Property="Height" Value="50" />
    <Setter Property="CornerRadius" Value="10" />
    <Setter Property="BorderBrush">
        <Setter.Value>
         <LinearGradientBrush StartPoint="0,0" EndPoint="1,2">
           <LinearGradientBrush.GradientStops>
              <GradientStop Color="Steelblue" Offset="0" />
              <GradientStop Color="SteelBlue" Offset="-0.05" />
              <GradientStop Color="White" Offset="0" />
              <GradientStop Color="SteelBlue" Offset="0" />
              <GradientStop Color="Steelblue" Offset="1" />
           </LinearGradientBrush.GradientStops>
         </LinearGradientBrush>
        </Setter.Value>
      </Setter>
    <Setter Property="BorderThickness" Value="2" />
    <Setter Property="Background" Value="CornflowerBlue" />
 
    <Style.Triggers>
          <Trigger Property="IsMouseOver" Value="True">
              <Trigger.EnterActions>
                  <BeginStoryboard>
                     <Storyboard>
                <DoubleAnimation Storyboard.TargetProperty="(BorderBrush).(LinearGradientBrush.GradientStops)[1].(GradientStop.Offset)" To="1.5" Duration="0:0:0.750" FillBehavior="Stop" />
                <DoubleAnimation Storyboard.TargetProperty="(BorderBrush).(LinearGradientBrush.GradientStops)[2].(GradientStop.Offset)" To="1.55" Duration="0:0:0.750" FillBehavior="Stop" />
                <DoubleAnimation Storyboard.TargetProperty="(BorderBrush).(LinearGradientBrush.GradientStops)[3].(GradientStop.Offset)" To="1.55" Duration="0:0:0.750" FillBehavior="Stop" />
                     </Storyboard>
                  </BeginStoryboard>
              </Trigger.EnterActions>
          </Trigger>
      </Style.Triggers>
   </Style>   
 
  </Page.Resources>
  
  <StackPanel Width="200">
    <Border Style="{StaticResource BorderStyle}" />
    <Border Style="{StaticResource BorderStyle}" />
    <Border Style="{StaticResource BorderStyle}" />
  </StackPanel>
  
</Page>
by Jerry Nixon
  July 02, 2010 @ 8:56am
Tags:
Description:
Just drop this XAML into XamlPad

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate