In the following code, person.Children contains 3 other Person objects. This code adds the child.Loaded event handler to all three, but child_Loaded only executes for the first two. Any idea why this is?
foreach ( Person child in person.Children)
{
//Add children in same position as parent
child.x_PositionTransform.X = person.x_PositionTransform.X;
child.x_PositionTransform.Y = person.x_PositionTransform.Y;
child.SetValue(Canvas.NameProperty, "child" + objCount++);
child.Click += new RoutedEventHandler(person_Click);
x_LayoutRoot.Children.Add(child);
child.Loaded += new RoutedEventHandler(child_Loaded);
}