RadDiagram dragging shapes

2 posts, 1 answers
  1. Dan
    Dan avatar
    8 posts
    Member since:
    Jul 2014

    Posted 31 Jan 2017 Link to this post

    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.
  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    2903 posts

    Posted 01 Feb 2017 Link to this post

    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.
Back to Top