title: How would I convert WPF storyboard code to VB.NET or C#.NET so that I can in the future create the story board in code
body: <p>I have a sample story board that I would like to know how to implement using code only but I am having trouble figuring it out. Here is the WPF/XAML, any pointers would be greatly appreciated.</p>
  
  <pre><code>&lt;Window x:Class="MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      AllowsTransparency="True"
          WindowStyle="None"
      Title="MainWindow" Height="350" Width="525" Background="Transparent" Topmost="True" WindowState="Maximized" ResizeMode="NoResize"&gt;
      &lt;Canvas Name="canvas1"&gt;
          &lt;Button Canvas.Left="145" Canvas.Top="155" Content="Button" Height="23" Name="Button1" Width="75"&gt;
              &lt;Button.Triggers&gt;
                  &lt;EventTrigger RoutedEvent="Button.MouseEnter"&gt;
                      &lt;BeginStoryboard&gt;
                          &lt;Storyboard&gt;
                              &lt;DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Button1" Storyboard.TargetProperty="Width" AutoReverse="true" RepeatBehavior="Forever"&gt;
                                  &lt;SplineDoubleKeyFrame KeyTime="00:00:00" Value="100"/&gt;
                                  &lt;SplineDoubleKeyFrame KeyTime="00:00:05" Value="300"/&gt;
                                  &lt;SplineDoubleKeyFrame KeyTime="00:00:10" Value="100"/&gt;
                              &lt;/DoubleAnimationUsingKeyFrames&gt;
                              &lt;DoubleAnimation 
                  Storyboard.TargetName="Button1"
                  Storyboard.TargetProperty="(Canvas.Left)"
                  From="100" To="600" Duration="0:0:10" AutoReverse="true" RepeatBehavior="Forever"/&gt;
                              &lt;DoubleAnimation 
                  Storyboard.TargetName="Button1"
                  Storyboard.TargetProperty="(Canvas.Top)"
                  From="100" To="600" Duration="0:0:10" AutoReverse="true" RepeatBehavior="Forever"/&gt;
                          &lt;/Storyboard&gt;
                      &lt;/BeginStoryboard&gt;
                  &lt;/EventTrigger&gt;
              &lt;/Button.Triggers&gt;
          &lt;/Button&gt;
      &lt;/Canvas&gt;
  &lt;/Window&gt;
  </code></pre>