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

RadDiagram dragging shapes

1 Answer 79 Views
Diagram, DiagramRibbonBar, DiagramToolBox
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 01 Feb 2017, 01:25 AM
How do I get the drag values (x,y coordinates) of a shape object as it is being dragged within the diagram?  I see there is a Drag event, but I am uncertain how to get the objects' position after a drag.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 01 Feb 2017, 08:40 AM
Hello Daniel,

The following code snippet shows how you can get the location of the dragged element:
public RadForm1()
{
    InitializeComponent();
    var ds = this.radDiagram1.ServiceLocator.GetService<IDraggingService>() as DraggingService;
    ds.Dragging += Ds_Dragging;
    ds.CompleteDragging += Ds_CompleteDragging;
}
 
private void Ds_CompleteDragging(object sender, PositionChangedEventArgs e)
{
    Console.WriteLine("Droped at:"+ e.NewPosition);
}
 
private void Ds_Dragging(object sender, PositionChangedEventArgs e)
{
    Console.WriteLine(e.NewPosition);
}

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Diagram, DiagramRibbonBar, DiagramToolBox
Asked by
Dan
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or