Articles in this section
Category / Section

How to customize the bridging style for connector in WPF Diagram (SfDiagram)?

1 min read

WPF Diagram (SfDiagram) provide a support to customize the Bridging style of Connector by overriding CreateSegments method. We have provided code example, screenshot and sample to represent this.

C#

//overriding CreateSegments method of Connector 
protected override IEnumerable<PathSegment> CreateSegments(Point start, Point end, BridgeDirection direction)
{
  Matrix m = Matrix.Identity;
  MatrixTransform trans = new MatrixTransform(m);
  var pathsegment = new List<PathSegment>()
  {
    new LineSegment() {Point = trans.Transform(new Point(start.X, start.Y - 10))},
    new LineSegment() {Point = trans.Transform(new Point(start.X + 16, start.Y - 10))},
    new LineSegment() {Point = trans.Transform(new Point(start.X + 16, start.Y))},
    new LineSegment() {Point =trans.Transform(new Point(end.X+16, end.Y)) }
  };
  foreach (var line in pathsegment)
  {
                yield return line;
  }
}

 

Customizing bridging style of WPF Diagram

 

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