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

How to capture drag events for RadDiagramConnection objects?

4 Answers 11 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 10 Sep 2019, 09:03 PM

Hi There,

Can anyone provide an example of how to catch connection 'drag & drop' events in a RadDiagram? I've bound all the connection related DnD events to a property handler but it get a hits very sporadically when moving the connections from one shape to another. The code is shown below. No doubt I'm doing something silly but I can't find any example anywhere in the docs. Any suggestions on how to get this to work are greatly appreciated.

 

Regards,

Eric G.

 

       // create some event handlers

       private void EdgeDragEnter(object sender, EventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("drag enter");
        }

        .....

       // create some connections and wire them to the handlers

     var connection = new RadDiagramConnection() { Source = edgePair.Key, Target = targetInfo.node, ... TargetCapType=CapType.Arrow2Filled};
                connection.DragEnter += EdgeDragEnter;
                connection.DragLeave += EdgeDragEnter;
                connection.Drop += EdgeDragEnter;
                connection.BeginEdit += EdgeDragEnter;
                connection.EndEdit += EdgeDragEnter;
                connection.GotFocus += EdgeDragEnter;
                connection.ManipulationCompleted += EdgeDragEnter;

4 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 11 Sep 2019, 02:06 PM

Hello Eric,

The diagram elements doesn't work with real drag/drop operations. Instead they use the mouse events. Keep in mind that when trying to customize drop-related functionality.

Can you tell me what exactly do you need to achieve? What drag and drop logic should be implemented?

Regards,
Martin Ivanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Eric
Top achievements
Rank 1
answered on 11 Sep 2019, 05:31 PM

Hi Martin,

I need a callback that is invoked when an edge is moved from node A to node B. Per your suggestion I've added connection.MouseUp/Down events thinking that this would fire the mouse up event when the mouse is released with the edge arrow on B but this is not the case. Any suggestions?

-Eric

        private void Connection_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("mouse down");
        }

        private void Connection_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("mouse up");
        }

       ....

       var connection = new RadDiagramConnection(...);

        connection.MouseDown += Connection_MouseDown;
        connection.MouseUp += Connection_MouseUp;

 

0
Eric
Top achievements
Rank 1
answered on 11 Sep 2019, 06:27 PM
Poking around some more I found that the ManipulationStarted event does reliably fire on the start of a connection move operation but my ManipulationCompleted event is never called (nor are any of the other Manipulation...() events.
0
Martin Ivanov
Telerik team
answered on 12 Sep 2019, 08:27 AM

Hello Eric,

The ManipulationStart/Completed events are part of the WPF's touch support and doesn't work with the diagram specific logic (like dragging connections). Those are inherited from the UIElement class. 

To achieve your requirement, you can use the ConnectionManipulationStarted and ConnectionManipulationCompleted events of RadDiagram.

Regards,
Martin Ivanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Diagram
Asked by
Eric
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Eric
Top achievements
Rank 1
Share this question
or