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

CompleteDragging XY different than Shape XY

1 Answer 54 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 07 Feb 2017, 12:55 AM

I am getting different XY coordinates on the CompleteDragging event than what the actual shape XY coordinates are (see image file).  Any clue how to get the correct XY coordinates? It seems like I am getting the XY of the center of the shape.  Below is the code I am using:

 

private void DragService_CompleteDragging(object sender, PositionChangedEventArgs e)
{
    label13.Text = $"{e.NewPosition.X},{e.NewPosition.Y}";
 
    foreach (var shape in radDiagram1.Shapes)
    {
        var myShape = shape as RadDiagramShape;
        if (myShape.Text == _asset.AssetTag)
        {
            label14.Text = $"{myShape.X},{myShape.Y}";
            break;
        }
    }
}


1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 07 Feb 2017, 11:07 AM
Hi Daniel,

The value of the NewPosition property is calculated depending on the current mouse position. Here is how you can get the shape location:
private void Ds_CompleteDragging(object sender, PositionChangedEventArgs e)
{
    var shape = e.Items.ToList()[0] as IShape;
    
    Console.WriteLine("Droped at:" + shape.Position);
}

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