Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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.
Posted 30-Aug-12 0:00am
ICube 2156
Edited 30-Aug-12 0:01am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 274
1 Sergey Alexandrovich Kryukov 255
2 Shweta N Mishra 216
3 PIEBALDconsult 200
4 BillWoodruff 174
0 OriginalGriff 7,630
1 Sergey Alexandrovich Kryukov 7,022
2 DamithSL 5,586
3 Manas Bhardwaj 4,946
4 Maciej Los 4,525


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 30 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100