Articles in this section
Category / Section

How to decide whether to drag or draw a connection on port at runtime in the WPF Diagram (SfDiagram)?

1 min read

By default, click and drag action on port will draw a new connection. This default behavior can be modified at runtime by using the SetTool() method of WPF Diagram (SfDiagram).

C#

public class CustomDiagram : SfDiagram
{
   protected override void SetTool(SetToolArgs args)
   {
      if (args.Source is IPort)
      {
        args.Action = ActiveTool.Drag;
      }
      else
      {
        base.SetTool(args);
      }
   }
}

View sample in GitHub.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied