We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get or set the positions of the segments by programmatically in UWP Diagram(SfDiagram)?

Platform: UWP |
Control: 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();

 

2X faster development

The ultimate UWP UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile