Item Offset When Dragging Started

Nathan Sokalski 4,126 Reputation points
2021-02-25T17:07:14.283+00:00

I am adding Drag/Drop to my Xamarin.Forms app, and when I start dragging, the item being dragged is offset so that the center of the item is where the pointer was pressed. Therefore, the item being dragged often ends up being not completely visible. I thought that I could fix this using the AnchorX & AnchorY properties, but they didn't seem to make any difference. How can I make the item being dragged move the same amount as the pointer? Thanks.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,326 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JarvanZhang 23,951 Reputation points
    2021-02-26T13:11:20.89+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    so that the center of the item is where the pointer was pressed. Therefore, the item being dragged often ends up being not completely visible

    Hi, njsokalski. I created a basic demo to test the function on an emulator, when dragging the view on the emulator, the mouse will always be in the center of the view. No matter where the drag point is placed on the view, the point will be located in the center of the view when dragging. You could test on an emulator to check that.

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.