title: Getting UIElement from Storyboard in Completed event Windows 8 App
body: <p>I have an Image that i'm animating with a Storyboard. I want to be able to change the source of the image after the storyboard animation has completed. However, I don't know how to access the Image in the Completed event handler. How can I gain access to the Image through a Storyboard object.</p>
  
  <pre><code>private void AnimateImage() {
      Image i = new Image();
      //Set name and source of image here
      i.RenderTransform = new CompositeTransform();
      Duration d = new Duration(TimeSpan.FromSeconds(2));
      DoubleAnimation anim1 = new DoubleAnimation();
      DoubleAnimation anim2 = new DoubleAnimation();
      anim1.Duration = d;
      anim2.Duration = d;
  
      Storyboard sb = new Storyboard();
      sb.Duration = d;
      sb.Children.Add(anim1);
      sb.Children.Add(anim2);
  
      Storyboard.SetTarget(anim1, i);
      Storyboard.SetTarget(anim2, i);
  
      Storyboard.SetTargetProperty(anim1, "(UIElement.RenderTransform).(CompositeTransform.TranslateX)");
      Storyboard.SetTargetProperty(anim2, "(UIElement.RenderTransform).(CompositeTransform.TranslateY)");
  
      //Set anim1/anim2 To/From properties
  
      sb.Completed += StoryboardCompleted;
      sb.Begin();
  }
  
  private void StoryboardCompleted(object sender, object o) {
      Storyboard sb = (Storyboard) sender;
      //How can I gain access to the Image?
  }
  </code></pre>
  
  <p>I'm doing this animation many times with multiple images so I cant simply make a member variable. I need to know which Image is done in the Completed event.</p>