title: Smooth pinch-zooming and panning on Windows Phone 8
body: <p>I've managed to implement pinch zooming and panning by hooking up to the ManipulationDelta and ManipulationStarted events (on an image control):</p>
  
  <pre><code>    private void image_OnManipulationDelta(object sender, ManipulationDeltaEventArgs e)
      {
          var transform = (CompositeTransform)image.RenderTransform;
  
          // pan
          transform.TranslateX = _translationX + e.CumulativeManipulation.Translation.X;
          transform.TranslateY = _translationY + e.CumulativeManipulation.Translation.Y;
  
          // zoom
          if (e.PinchManipulation != null)
          {
              transform.CenterX = e.PinchManipulation.Original.Center.X;
              transform.CenterY = e.PinchManipulation.Original.Center.Y;
  
              transform.ScaleX = _scaleX * e.PinchManipulation.CumulativeScale;
              transform.ScaleY = _scaleY * e.PinchManipulation.CumulativeScale;
          }
      }
  
      private void image_OnManipulationStarted(object sender, ManipulationStartedEventArgs e)
      {
          // the user has started manipulating the screen, set starting points
          var transform = (CompositeTransform)image.RenderTransform;
          _scaleX = transform.ScaleX;
          _scaleY = transform.ScaleY;
          _translationX = transform.TranslateX;
          _translationY = transform.TranslateY;
      }
  </code></pre>
  
  <p>But the compared to the smoothness of the rest of the windows phone UI it feels very placid and stiff. There  is no inertia in the movement. </p>
  
  <p>Is there a way to make the movements more smooth? Is using animations and storyboards a way to go about it? I've tried using ScrollView for at least getting smooth panning but then the ManipulationDelta events are not firing correctly.</p>