This is a migrated thread and some comments may be shown as answers.

DragVisual position relative to cursor

4 Answers 157 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Vincent
Top achievements
Rank 1
Vincent asked on 03 Dec 2012, 01:18 PM
Hi,

I use an Image that is shown when dragging:
args.DragVisual = new ContentControl { Content = MyImage, Width = 25, Height = 25 };
This image always shows up at a certain position relative to the cursor. Can I influence this position? I tried DragVisualOffset but - maybe I used it incorrect - that didn't result in a change of position. Thanks in advance, Vincent

4 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 03 Dec 2012, 01:23 PM
Hello Vincent,

You can use the DragVisualOffset property in combination with the RelativeStartPoint properties of the DragInitializeEventArgs to achieve the desired effect. 

Hope this helps! 

Regards,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Vincent
Top achievements
Rank 1
answered on 03 Dec 2012, 03:42 PM
Hello Nik,

the property RelativeStartPoint has an internal setter which I therefore can't change in the OnDragInitialize eventhandler which is passed to the DragDropManager:

DragDropManager.AddDragInitializeHandler(control, OnDragInitialize, true);

Should I change this property (together with DragVisualOffset) somewhere else instead of in this handler? 

Kind regards,
Vincent
0
Accepted
Nick
Telerik team
answered on 03 Dec 2012, 03:45 PM
Hello Vincent,

The RelativeStartPoint property gives you the relative coordinates of the mouse pointer when starting a drag operation. You cannot set it. You can use it to calculate your own offset, and set it to the DragVisualOffset propery.

Hope this helps! 

Kind regards,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Vincent
Top achievements
Rank 1
answered on 04 Dec 2012, 08:12 AM
Hi,

the reason it didn't work in my case was that I probably used absolute X,Y-coordinates instead of calculated relative to RelativeStartPoint. I found the right piece of code in this topic:
http://www.telerik.com/community/forums/silverlight/diagram/drop-event-of-raddiagram-is-not-working.aspx

Thanks,
Vincent
Tags
DragAndDrop
Asked by
Vincent
Top achievements
Rank 1
Answers by
Nick
Telerik team
Vincent
Top achievements
Rank 1
Share this question
or