Category / Section
How to get or set the positions of the segments by programmatically in UWP Diagram(SfDiagram)?
ToPoints() and LoadSegments() methods of the IConnectorInfo can be used to retrieve and update the positions of the connector segments respectively.
C#
//Initialize the SfDaigram
SfDiagram diagram = new SfDiagram();
//Initialize the connectors collection
diagram.Connectors = new ConnectorCollection();
//Create the new connector view model
ConnectorViewModel connector = new ConnectorViewModel()
{
SourcePoint = new Point(400,400),
TargetPoint = new Point(800,200),
};
//To add the connector into connector collection
(diagram.Connectors as ConnectorCollection).Add(connector);
//Initialize the list of points.
List<Point> segmentsPoints = new List<Point>() { new Point(20, 20), new Point(30, 30) };
// Set segment points to the connector segment using LoadSegment() method.
(connector.Info as IConnectorInfo).LoadSegments(segmentsPoints);
//To get segment points of the connector segment
IEnumerable<Point> segmentPoints = (connector.Info as IConnectorInfo).ToPoints();