title: How can I get the new position and size of a UIElement after performing a RenderTransform (Scale & Translate)?
body: <p>I am performing scaling, translation and rotation on an image using RenderTransform. Transformations are not done using mouse events, rather, the user will click a button and then the image will scale/translate/rotate on a fixed value.</p>
  
  <p>My problem is I want to determine the new position/size of the image each time a scaling, translation or rotation is performed. So I added Changed events on the code-behind. The question is how do you get the new position/size?</p>
  
  <p>Please take a look at what I've done so far:</p>
  
  <p><strong>XAML:</strong></p>
  
  <pre><code>&lt;Border x:Name="mainImageBorderCtrl" ClipToBounds="True"&gt;
       &lt;Grid x:Name="imageGridCtrl"&gt;
            &lt;Grid.RenderTransform&gt;
                 &lt;TranslateTransform Changed="TranslateTransform_Changed"/&gt;
            &lt;/Grid.RenderTransform&gt;
            &lt;Image x:Name="mainImageCtrl" RenderTransformOrigin="0.5, 0.5" Source="{Binding Image}"&gt;
                 &lt;Image.RenderTransform&gt;
                      &lt;TransformGroup&gt;
                           &lt;ScaleTransform Changed="ScaleTransform_Changed"/&gt;
                           &lt;RotateTransform /&gt;
                      &lt;/TransformGroup&gt;
                 &lt;/Image.RenderTransform&gt;
            &lt;/Image&gt;
       &lt;/Grid&gt;
  &lt;/Border&gt;
  </code></pre>
  
  <p>Please note that I separated TranslateTransform from ScaleTransform and RotateTransform so that the orientation won't be affected.</p>
  
  <p>The following are the 2 changed events. In here, I expect to get the new position/size every time a scale or a translate has occurred. But the bounds values do not change.</p>
  
  <p><strong>Code-behind</strong></p>
  
  <pre><code>private Rect bounds;
  
  private void TranslateTransform_Changed(object sender, EventArgs e)
  {
       bounds = imageGridCtrl.TransformToAncestor(mainImageBorderCtrl).TransformBounds(new Rect(imageGridCtrl.RenderSize));
  }
  
  private void ScaleTransform_Changed(object sender, EventArgs e)
  {
       bounds = imageGridCtrl.TransformToAncestor(mainImageBorderCtrl).TransformBounds(new Rect(imageGridCtrl.RenderSize));
  }
  </code></pre>
  
  <p><strong>EDIT</strong>: My goal here is to restrict the translation(panning) of the Image inside the Border control, that's why I need to get the bounds of the Image after each transformation, whatever the transformation is, so that I can check whether the bounds of the Image exceeds the Border.</p>