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

How to add Connectors programmatically

Hi,

I'd like to add nodes and connectors programmatically with a UserHandle.
On the OnUserHandleMouseDown event i have created a new node that relates
to the selected node and also added a connector. But the connector is not shown.

Btw: This works on the OnInitialized() without any problem.

        public async void OnApplyShortcut(UserHandleEventsArgs args)
        {
            var selectedNode = this.Diagram.SelectedItems.Nodes.FirstOrDefault();
            if (selectedNode == null) return;

            var relatedNode = new DiagramNode();
            this.Nodes.Add(relatedNode);

            var connector = new DiagramConnector();
            connector.SourceID = selectedNode.Id;
            connector.TargetID = relatedNode.Id;

            this.Connectors.Add(connector);
        }

3 Replies

NG Naganathan Ganesh Babu Syncfusion Team February 10, 2020 04:11 AM

Hi Manuel, 
 
The reported issue is a known issue and we have already fixed this issue. The fix will be included in our weekly nuget package release on 11th February, 2020.  
 
 
Regards, 
 
Naganathan K G 



MA Manuel February 10, 2020 04:33 AM

Thanks for the information.


SG Shyam G Syncfusion Team February 11, 2020 12:59 AM

Hi Manuel, 
Thanks for your update. 
Regards, 
Shyam G 


Loader.
Live Chat Icon For mobile
Up arrow icon