Hello,
I have a Panorama with one Group (Group A) that contains a few tiles. I have changed the AllowDrag and AllowDrop for allow of these tiles to false to prevent Users from rearranging "Group A" tiles. At run-time, more groups and tiles are dynamically added based on individual user setting files. I am using the panorama.PanoramaElement.DragDropService.PreviewDragOver event to prevent users from dragging dynamically added tiles to "Group A".
First I get the position of the cursor on the Panorama using panorama.PointToClient(MousePosition). Then I get the left most Group (Group B) that is not "Group A" and set the EventArgs.CanDrop to false if the cursor is left of "Group B's" ControlBoundingRectangle.Left.
However, I found that if you drag a tile by first clicking on the right most edge of the tile and position the cursor just to the right of "Group B's" ControlBoundingRectangle's left edge, most of the tile hovers over the "Group A" but the cursor is within "Group B" and EventArgs.CanDrop is set to true. So when the user release the mouse, it puts the tile in "Group A".
I looked at panorama.PanoramaElement.DragDropService.PreviewDragDrop and the EventArgs.DropLocation.X was 165 when in the panorama.PanoramaElement.DragDropService.PreviewDragOver the panorama.PointToClient(MousePosition).X was 250 (under 250 is when EventArgs.CanDrop is set to false).
How can I determine if a tile is going to be dropped into "Group A" and cancel or prevent it?