title: DoubleAnimation in ScaleTransform
body: <p>I'm trying, as an exhibition, to use a DoubleAnimation on the ScaleX and ScaleY properties of a ScaleTransform.  I have a rectangle (144x144) which I want to make rectangular over five seconds.</p>
  
  <p>My XAML:</p>
  
  <pre><code>&lt;Window x:Class="ScaleTransformTest.Window1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="Window1" Height="300" Width="300" Loaded="Window_Loaded"&gt;
      &lt;Grid&gt;
          &lt;Rectangle Name="rect1" Width="144" Height="144" Fill="Aqua"&gt;
              &lt;Rectangle.RenderTransform&gt;
                  &lt;ScaleTransform ScaleX="1" ScaleY="1" /&gt;
              &lt;/Rectangle.RenderTransform&gt;
          &lt;/Rectangle&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>My C#:</p>
  
  <pre><code>private void Window_Loaded(object sender, RoutedEventArgs e)
  {
      ScaleTransform scaly = new ScaleTransform(1, 1);
      rect1.RenderTransform = scaly;
  
      Duration mytime = new Duration(TimeSpan.FromSeconds(5));
      Storyboard sb = new Storyboard();
  
      DoubleAnimation danim1 = new DoubleAnimation(1, 1.5, mytime);
      DoubleAnimation danim2 = new DoubleAnimation(1, 0.5, mytime);
      sb.Children.Add(danim1);
      sb.Children.Add(danim2);
  
      Storyboard.SetTarget(danim1, scaly);
      Storyboard.SetTargetProperty(danim1, new PropertyPath(ScaleTransform.ScaleXProperty));
      Storyboard.SetTarget(danim2, scaly);
      Storyboard.SetTargetProperty(danim2, new PropertyPath(ScaleTransform.ScaleYProperty));
  
      sb.Begin();
  }
  </code></pre>
  
  <p>Unfortunately, when I run this program, it does nothing.  The rectangle stays at 144x144.  If I do away with the animation, and just</p>
  
  <pre><code>ScaleTransform scaly = new ScaleTransform(1.5, 0.5);
  rect1.RenderTransform = scaly;
  </code></pre>
  
  <p>it will elongate it instantly, no problem.  There is a problem elsewhere.  Any suggestions?  I have read the discussion at <a href="http://www.eggheadcafe.com/software/aspnet/29220878/how-to-animate-tofrom-an.aspx" rel="nofollow noreferrer">http://www.eggheadcafe.com/software/aspnet/29220878/how-to-animate-tofrom-an.aspx</a> in which someone seems to have gotten a pure-XAML version working, but the code is not shown there.</p>
  
  <p>EDIT: At <a href="https://stackoverflow.com/questions/2131797/applying-animated-scaletransform-in-code-problem">Applying animated ScaleTransform in code problem</a> it seems someone had a very similar problem, I am fine with using his method that worked, but what the heck is that <code>string thePath = "(0).(1)[0].(2)";</code> all about?  What are those numbers representing?</p>