title: Getting the UIElement from an animation completed event
body: <p>From my codebehind I want to start an animation on a specific <code>UIElement</code>, when that animation ends I would like to do some other processing on that <code>UIElement</code>. I am having trouble figuring out how to convert the <code>AnimationClock</code> object that I receive as the sender of an Animation Completed event into the <code>UIElement</code> object that the animation was performed on.</p>
  
  <p>Here is the code I use to build and start the animation:</p>
  
  <pre><code>DoubleAnimation FadeOutAnim = new DoubleAnimation(1, 0, TimeSpan.FromSeconds(.5));
  FadeOutAnim.Completed += new EventHandler(FadeOutAnim_Completed);
  
  UIElement element = lstMessages.ItemContainerGenerator.ContainerFromItem(sender) as UIElement;
  if(element != null)
     element.BeginAnimation(UIElement.OpacityProperty, FadeOutAnim);
  </code></pre>
  
  <p>And here is my Completed event where I want access to the <code>UIElement</code> again.</p>
  
  <pre><code>void FadeOutAnim_Completed(object sender, EventArgs e)
      {
          UIElement animation = sender; //This is an AnimationClock and I can't seem to figure out how to get my UIElement back.
  
      }
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>