New to Telerik UI for WPF? Start a free 30-day trial
Prevent RadDiagramConnection Point from Delete
Updated on Apr 3, 2026
Environment
| Product Version | 2019.3.1023 |
| Product | RadDiagram for WPF |
Description
How to prevent the RadDiagramConnection point from being deleted.
Solution
To achieve this requirement, you can handle the PreviewMouseLeftButtonDown event of RadDiagram in the situation when Ctrl is pressed, and a RadDiagramConnection point is under the mouse.
Example 1: Prevent RadDiagramConnection Point from Delete
C#
private void Diagram_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var selectionService = this.diagram.ServiceLocator.GetService<ISelectionService<IDiagramItem>>() as SelectionService;
if (KeyboardModifiers.IsControlDown)
{
var selectedConnection = selectionService.SelectedConnections.FirstOrDefault();
if (selectedConnection != null)
{
var position = e.GetPosition(this.diagram);
var transformedPosition = this.diagram.GetTransformedPoint(position);
var relativePoint = new Point(transformedPosition.X - 5, transformedPosition.Y - 5);
var rect = new Rect(relativePoint, new Size(10, 10));
if (selectedConnection.ConnectionPoints.Any(rect.Contains))
{
e.Handled = true;
}
}
}
}