title: Want to set storyboard target property as horizontal offset of a scrollviewer
body: <p>I am using scroll viewer in my app which shows images in a horizontal view. I need to use animation while scrolling like in this video how to acheive this</p>
  
  <p><a href="http://www.youtube.com/watch?v=XVHVBMeqL24" rel="nofollow">http://www.youtube.com/watch?v=XVHVBMeqL24</a></p>
  
  <p>I have tried this</p>
  
  <pre><code>   public Storyboard CreateAndApplyStoryboard(UIElement targetElement)
      {
  
          Storyboard sb = new Storyboard();
  
  
          DoubleAnimation animation =
              new DoubleAnimation { From = 0, To = 500, Duration = new Duration(TimeSpan.FromSeconds(1.0)) };
  
          //ExponentialEase ese = new ExponentialEase();
          //ese.EasingMode = EasingMode.EaseIn;
          //animation.EasingFunction = ese;
          Storyboard.SetTarget(animation, targetElement);
          Storyboard.SetTargetProperty(animation,
              new PropertyPath(ScrollViewer.HorizontalOffsetProperty));
  
  
  
          sb.Children.Add(animation);
          return sb;
      }
  </code></pre>
  
  <p>I am just showing the example i need to scroll from horizontal offset 0 to 500</p>
  
  <p>How to use the dependency property?</p>
  
  <pre><code>  &lt;scrollviewer name="scroll"&gt;
    &lt;StackPanel Name="stack" Width="5000" Orientation="Horizontal"  HorizontalAlignment="Left" &gt;
          &lt;StackPanel.RenderTransform&gt;
                  &lt;TranslateTransform x:Name="Trans2" X="0" Y="0" /&gt;
              &lt;/StackPanel.RenderTransform&gt;
      &lt;/StackPanel&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>private void button1_Click(object sender, RoutedEventArgs e)
      {                                 
              Storyboard sb = CreateAndApplyStoryboard(scroll);
              sb.Begin();
  
          }
  </code></pre>