How to detect if a Surface Contact is over a ScatterView?
Posted
by Bart Roozendaal
on Stack Overflow
See other posts from Stack Overflow
or by Bart Roozendaal
Published on 2009-04-05T16:17:29Z
Indexed on
2010/03/08
13:06 UTC
Read the original article
Hit count: 731
This is a (kind of) similar situation as in the SDK Sample Shopping Cart for MS Surface.
I have an application with two ScatterViews. The first covers the complete Surface window ('surface'). The second resides in a TagVisualization object ('pod'). There might be more than one pod available (if more than one tag is down on the table).
I would like to be able to drag a ScatterViewItem from the 'pod' to the 'surface' or another 'pod'. I have no problems in detecting if a ScatterViewItem is leaving its ScatterView parent. Also, no problems in reparenting the ScatterViewItem.
However, I want to detect which ScatterView the item is being dragged on. In the SDK Sample they have used a visual element (an ellipse in this case) which is below the ScatterViews. VisualTreeHelper.HitTest is used to determine if the contact is over the ellipse. If so, the 'connected' ScatterView is found.
I don't think this is a very elegant solution. I wouldn't want a visual element put in there, just to detect if a contact is over a ScatterView.
Are there betterwways to accomplish this kind of 'hittesting'?
Thanks, Bart
© Stack Overflow or respective owner