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
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/.
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?
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/.