How to change default properties when adding shape or line with ActivateTool of diagram?

Hi~

I used to run the demo you provided.



I read the demo code and it calls ActivateTool method.
The background color of the shape is yellow by default.
I want to change the default properties such as line weight, color or background color of the shape.

How can I change the default properties?


1 Reply 1 reply marked as answer

GG Gowtham Gunashekar Syncfusion Team January 25, 2021 02:16 PM UTC

Hi Nam, 
 
we suggest you to use Diagram NodeCollectionChanged event to update modify the default color, line style of the node/connector while adding the nodes 
 
Code snippet: 
 
 
     diagram1.EventSink.NodeCollectionChanged += EventSink_NodeCollectionChanged; 
 
 
 
        private void EventSink_NodeCollectionChanged(CollectionExEventArgs evtArgs) 
        { 
           if(evtArgs.ChangeType == CollectionExChangeType.Insert) 
            { 
                if(evtArgs.Element is FilledPath) 
                { 
                      // to change  
                    (evtArgs.Element as FilledPath).FillStyle.Color = Color.Brown; 
                } else if(evtArgs.Element is ConnectorBase) 
                { 
                    (evtArgs.Element as ConnectorBase).LineStyle.LineColor = Color.Red; 
                } 
            } 
        } 
 
 
Regards, 
 
Gowtham 


Marked as answer
Loader.
Up arrow icon