In Silverlight I've created a panel that derives from standard Panel class and have overridden the InvalidateMeasure() and InvalidateArrange() methods. The Panel uses an own Attached Property "Position" of type Point to specify the position of objects. Whenever the attached property is changed, I call InvalidateArrange() to refresh the rendered positions.
In addition I use Animations for smooth drag'n drop-transitions that are attached to the Position-property. If now such an animation is executed, the InvalidateArrange() method is consequently called several times.
A strange effect is now that MouseEnter- or MouseLeave-events on other children of the panel are triggered, even though the mouse pointer is far away from them. Also the Hit-Testing does not work correctly after an InvalidateArrange() is triggered.
That is the case even though typically only the position of one child (the dragged one) actually changes in ArrangeOverride().
If I analyze the relative position of the mouse pointer in the erraneously triggered MouseEnter-event handler, I can even programmatically check that the pointer is outside the triggering child-element: The coordinates of the returned points p and p2 below are mostly negative in such a case.
void Child_MouseEnter(object sender, MouseEventArgs e)
{
Point p = e.GetPosition(this);
Point p2 = e.GetPosition(e.OriginalSource as UIElement);
Has someone made similar experiences ? At the moment I can only think of a bug in Silverlight.
Additional info: the panel is used inside a ScrollViewer.