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

Support for the ConnectionChanged Event change the style for Connector

Hi ,

I want to change the color(style) of connector on ConnectionChanged event
whenever the sourceId and targetId is changed need to change the color for connector

 private void OnConnectionChanged(ConnectionChangedEventArgs args)
  {

       var _selectedConnector = args.Connector;

       (args.Connector as Connector).Style = new ShapeStyle() { StrokeWidth = 2, StrokeColor = "red" }; 

                //args.Connector.TargetDecorator.Style = new ShapeStyle() { Fill = "red", StrokeColor = "blue" };

       (args.Connector as Connector).TargetDecorator = new DecoratorSettings()

                {

                    Height = 5,

                    Width = 5,

                    Style = new ShapeStyle() { Fill = "red", StrokeColor = "red" },

                };

}

but unfortunately nothing take effects, is there any other event or I am missing something here?
please help?


3 Replies

SU Sumathi Uthayakumar Syncfusion Team December 2, 2022 11:48 AM UTC


Anil,

Reported issue: When we change the connector's style in a connection changed event, the change has not been updated


We have confirmed that the reported issue is a bug and have logged a defect report regarding it. We will fix the issue and include the fix in our upcoming weekly NuGet release, which is expected to be rolled out on December 13, 2022. We appreciate your patience until then.


Meanwhile, you can track the status of the bug at the following link:


Feedback Link: https://www.syncfusion.com/feedback/39558/connector-style-cannot-change-in-connectionchange-event


Disclaimer: The inclusion of this solution in the weekly release may change due to other factors, including but not limited to QA checks and work reprioritization.



AG Anil Guliyaan December 12, 2022 02:18 PM UTC

Thanks  Sumathi Uthayakumar for your reply 



SU Sumathi Uthayakumar Syncfusion Team December 13, 2022 06:14 AM UTC


Anil,


We have fixed the reported issue "When we change the connector's style in a connection changed event, the change has not been updated" and included the fix in our weekly patch release (v20.3.0.61). Along with this fix, in the connection changed event, you updated multiple properties for the connector. When you update multiple properties at runtime, you need to call beginupdate and endupdate. Beginupdate prevents visual updates to the diagram until the EndUpdate() method is called. Endupdate means that the diagram is unlocked following a call to the BeginUpdate(Boolean) method, resulting in an immediate visual update. We have shared a modified code snippet for your reference. Please update the "Syncfusion.Blazor.Diagram" package to the latest version in your application to resolve the reported issue. Please find the package link below.



Code Snippet:


 private void OnConnectionChanged(ConnectionChangedEventArgs args)
  {

       var _selectedConnector = args.Connector;

      Diagram.BeginUpdate();

       (args.Connector as Connector).Style = new ShapeStyle() { StrokeWidth = 2, StrokeColor = "red" }; 

                //args.Connector.TargetDecorator.Style = new ShapeStyle() { Fill = "red", StrokeColor = "blue" };

       (args.Connector as Connector).TargetDecorator = new DecoratorSettings()

                {

                    Height = 5,

                    Width = 5,

                    Style = new ShapeStyle() { Fill = "red", StrokeColor = "red" },

                };

Diagram.EndUpdate();

}

 


https://www.nuget.org/packages/Syncfusion.Blazor.Diagram



Please let us know if you need any further assistance.


Loader.
Up arrow icon