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

RadDiagramConnection draw vertical and horizontal

5 Answers 144 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
ja
Top achievements
Rank 1
ja asked on 26 Jul 2017, 06:46 PM
Hi,
Is it posible to modify RadDiagramConnection to draw lines with 45, 90, 135, 180 ... degrees. Something like in Paint when I want to draw line, with shift button(showed in .gif). Gif from paint show what I want to do in RadDiagram using RadDiagramConnection

5 Answers, 1 is accepted

Sort by
0
ja
Top achievements
Rank 1
answered on 27 Jul 2017, 01:20 PM
Problem solved.
0
Robby
Top achievements
Rank 1
answered on 27 Nov 2020, 08:55 AM | edited on 16 Nov 2023, 08:59 PM
.
0
Martin Ivanov
Telerik team
answered on 30 Nov 2020, 11:44 AM

Hello Robby,

You can achieve this requirement with a custom ConnectionTool. Basically, you can override its MouseMove and MouseUp methods and manually update the end point of the connection. You can see this approach in the attached project.

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Robby
Top achievements
Rank 1
answered on 08 Dec 2020, 01:11 PM

Hi Martin,

Thanks to post this example. I have tried to extend this example to enable the horizontal option only when pressing ctrl keys. Problem is that the tool is not working when modifying a selected connection afterwards. I want to enable the horizontal feature on existing connections when ctrl is pressed.  It is partly working already, but the preview line is currently incorrect.

Can I ask to add this as a default feature in the diagram control? 

PS: I was not able to post a zip file?

0
Martin Ivanov
Telerik team
answered on 10 Dec 2020, 05:56 PM

Hello Robby,

To achieve this functionality also when you move the connection, you can implement a custom ConnectionManipulationTool tool and override its mouse related methods similar to the custom ConnecitonTool. 

public class CustomConnectionManipulationTool : ConnectionManipulationTool
{
	private IManipulationPointService ManipulationService
	{
		get
		{
			return this.Graph.ServiceLocator.GetService<IManipulationPointService>();
		}
	}

	public override bool MouseMove(PointerArgs e)
	{
		var baseResult = base.MouseMove(e);
		if (ToolService.IsControlDown && ToolService.IsMouseDown)
		{
			if (this.ManipulationService.IsManipulating || this.ManipulationService.StartManipulate(e.TransformedPoint))
			{
				this.ManipulationService.Manipulate(e.TransformedPoint); // here you will need to change the e.TransformedPoint value and pass it to the Manipulate method
			   
			}
		}
		return baseResult;
	}
}

public Example()
{
	InitializeComponent();
	var toolService = (ToolService)this.xDiagram.ServiceLocator.GetService<IToolService>();
	toolService.ToolList[7] = new CustomConnectionManipulationTool();   
}

Note that, you can share any feature suggestions or bug reports in the Telerik UI for WPF feedback portal.

About the .zip file, the forum allows attaching only image files.

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Diagram
Asked by
ja
Top achievements
Rank 1
Answers by
ja
Top achievements
Rank 1
Robby
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or