title: windows phone get image size after transform
body: <p>I'm going crazy, I searched all day trying to solve this problem, I binded an image froma db and pinch to zoom works:</p>
  
  <pre><code> &lt;Grid x:Name="LayoutRoot"&gt;
  
      &lt;ProgressBar x:Name="progressBar" Width="480" Margin="0,125,0,0" Height="10" VerticalAlignment="Top" IsIndeterminate="{Binding ShowProgressBar}" Visibility="{Binding ShowProgressBar, Converter={StaticResource BooleanToVisibilityConverter}}"&gt;&lt;/ProgressBar&gt;
  
      &lt;Image x:Name="image" CacheMode="BitmapCache" Width="480" Stretch="Uniform" VerticalAlignment="Center"&gt;
          &lt;Image.RenderTransform&gt;
              &lt;CompositeTransform x:Name="transform" /&gt;
          &lt;/Image.RenderTransform&gt;
          &lt;toolkit:GestureService.GestureListener&gt;
              &lt;toolkit:GestureListener PinchStarted="OnPinchStarted" PinchDelta="OnPinchDelta" PinchCompleted="OnPinchCompleted" DragDelta="OnDragDelta" DragStarted="OnDragStarted" DragCompleted="OnDragCompleted" /&gt;
          &lt;/toolkit:GestureService.GestureListener&gt;
      &lt;/Image&gt;
  
  &lt;/Grid&gt;
  
  
  
      private void OnPinchStarted(object sender, PinchStartedGestureEventArgs e)
      {
          image = sender as Image;
          transform = image.RenderTransform as CompositeTransform;
          initialScale = transform.ScaleX;
      }
  
      private void OnPinchDelta(object sender, PinchGestureEventArgs e)
      {
          if (initialScale &gt;= 1)
          {
              transform.ScaleX = initialScale * e.DistanceRatio;
              transform.ScaleY = initialScale * e.DistanceRatio;
          }
      }
  
      private void OnPinchCompleted(object sender, PinchGestureEventArgs e)
      {
          if ((transform.ScaleX &lt; 1) || (transform.ScaleY &lt; 1))
          {
              transform.ScaleX = 1;
              transform.ScaleY = 1;
              transform.TranslateX = 0;
              transform.TranslateY = -240;
          }
      }
  
      private void OnDragStarted(object sender, DragStartedGestureEventArgs e)
      {
          PANEL_DRAG_HORIZONTAL = 0;
      }
  
      private void OnDragDelta(object sender, DragDeltaGestureEventArgs e)
      {
          if ((transform.ScaleX &lt;= 1) || (transform.ScaleY &lt;= 1))
          {
              if (e.Direction == System.Windows.Controls.Orientation.Horizontal)
              {
                  PANEL_DRAG_HORIZONTAL += e.HorizontalChange;
              }
          }
          else
          {
              transform.TranslateX += e.HorizontalChange;
              transform.TranslateY += e.VerticalChange;
          }
      }
  
      private void OnDragCompleted(object sender, DragCompletedGestureEventArgs e)
      {
          if (transform.TranslateX &gt; 0)
              transform.TranslateX = 0;
          if (transform.TranslateY &gt; -240)
              transform.TranslateY = -240;
  
          if ((transform.ScaleX &lt;= 1) || (transform.ScaleY &lt;= 1))
          {
              if (e.Direction == System.Windows.Controls.Orientation.Horizontal)
              {
                  var abs = Math.Abs(PANEL_DRAG_HORIZONTAL);
                  if (abs &gt; 75)
                  {
                      if (PANEL_DRAG_HORIZONTAL &gt; 0) // MovePrevious;
                      { MessageBox.Show("prev"); }
                      else //MoveNext();
                      { MessageBox.Show("next"); }
                      e.Handled = true;
                  }
              }
          }
      }
  </code></pre>
  
  <p>but i cannot get the correct size of the image after transform, because i want to avoid lost it after dragging on left/bottom side... I handled this problem for top/left easily here</p>
  
  <pre><code>  private void OnDragCompleted(object sender, DragCompletedGestureEventArgs e)
      {
          if (transform.TranslateX &gt; 0)
              transform.TranslateX = 0;
          if (transform.TranslateY &gt; -240)
              transform.TranslateY = -240;
  </code></pre>
  
  <p>I'm sorry if something it's not clear, but i'm really devasted...hope in your help</p>