title: Rotate Object from Code
body: <p>I want to rotate a polygon made in XAML with C# code, however I'm stuck on the Propertypath. Does someone know what I should use instead?</p>
  
  <p>This is the C# code I have right now:</p>
  
  <pre><code>public void Rotate()
  {
      Storyboard rotate = new Storyboard();
  
      DoubleAnimation myDoubleAnimation = new DoubleAnimation();
      myDoubleAnimation.From = 0;
      myDoubleAnimation.To = 360;
      myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(5));
  
      Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath("(Polygon.RenderTransform).(RotateTransform.Angle)"));
      Storyboard.SetTargetName(myDoubleAnimation, Arrowhead.Name);
      rotate.Children.Add(myDoubleAnimation);
      rotate.Begin(Arrowhead);
  }
  </code></pre>
  
  <p>And here is the polygon(triangle) I want to rotate in XAML:</p>
  
  <pre><code>                &lt;Polygon Fill="#41b1ff"
                   Stroke="Gray"
                   StrokeThickness="2"
                   Points="80,60,100,40,100,40,120,60" 
                   Grid.ColumnSpan="3"
                   Grid.RowSpan="3"
                   Name="Arrowhead"
                       /&gt;
  </code></pre>