title: Programmatically scrolling a ScrollViewer with a timer becomes jerky
body: <p>Animating the scrolling in a <code>ScrollViewer</code> seems to be a common task. I implemented it using a timer, similar to the approach found <a href="https://stackoverflow.com/q/2984803/938695">here</a>. This method was working great, it was very smooth and looked perfect. </p>
  
  <p>However, now that the complexity and number of objects contained within my <code>ScrollViewer</code> has increased, the animation looks very jerky. I find this odd because it works fine if I scroll manually.</p>
  
  <pre><code>    public void ShiftLeft(int speed = 11)
      {
          CustomTimer timer = new CustomTimer(); //DispatchTimer with "life"
          timer.Interval = new TimeSpan(0, 0, 0, 0, 5);
          timer.Tick += ((sender, e) =&gt;
          {
              scrollViewer1.ScrollToHorizontalOffset(
                  scrollViewer1.HorizontalOffset - (scrollViewer1.ScrollableWidth / (gridColumnCount - 3) / speed));
              if (scrollViewer1.HorizontalOffset == 0) //cant scroll any more
                  ((CustomTimer)sender).Stop();
              ((CustomTimer)sender).life++;
              if (((CustomTimer)sender).life &gt;= speed) //reached destination
                  ((CustomTimer)sender).Stop();
          });
          timer.Start();
      }
  </code></pre>
  
  <p>Is there a problem with my approach that is causing this weird jerking? Any idea how to fix it?</p>