title: Silverlight Usercontrol Onload Event when generated in another Usercontrol, to apply farseer physics
body: <p>Didn't know how to phrase the question better but basically I have a usercontrol that I dynamically add into another usercontrol. The child usercontrol has a set of images and basically I need to know if they have fully loaded inside the parent usercontrol since I need their dimentions for a method (not just height and width).</p>
  
  <p>Is there a type of event that can trigger when all the images in the child usercontrol have loaded in the parent?</p>
  
  <p>To further explain my scenario, I need this since I am using farseer physics engine for silverlight and it aquires the shape of the image to use for collision detection, and since when I try to turn the images into a physics object it would not find the shape since the image is still being generated on screen and therefore throws an exception.</p>
  
  <p>Update: This is what I have came up with so far</p>
  
  <pre><code>void currImg_ImageOpened(object sender, RoutedEventArgs e)
  {
  
      var ImagesLoaded = true;
      for (int i = 0; i &lt; ImageLoaded.Count-1; i++)
      {
          if (!ImageLoaded[i])
          {
              ImagesLoaded = false;
              ImageLoaded[i] = true;
              break;
          }
      }
  
      if (ImagesLoaded)
      {
          addPuppetPhysics(pg.currPuppet);
      }
  
  }
  </code></pre>
  
  <p>Where <code>ImageLoaded</code> is a list of booleans, the method <code>addPuppetPhysics</code> applies the farseer physics to the usercontrol <code>pg.currPuppet</code> . Thing is the physics engine finds the first half of the images then doesn't find anymore (crashes on the same Image). If I merely load the usercontrol, then apply the physics with a button click, it works perfectly. </p>