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

Customizing Appearance on Rendering with using NodeCollectionChange Events

Customizing Appearance on Rendering while using NodeCollectionChanged Events

Syncfusion Diagram supports customizing the appearance of the node using the NodeCollectionChanged events. Using the NodeCollectionChanged events the node can be customized.

The below code shows how to customize the appearance of the node.


// Registering NodeCollectionChanged Event
diagram2.EventSink.NodeCollectionChanged += EventSink_NodeCollectionChanged;
// Customizing the Appearance of the node
void EventSink_NodeCollectionChanged(CollectionExEventArgs evtArgs)
            if (evtArgs.Elements is NodeCollection || evtArgs.Element is Node)
                if (evtArgs.Elements is NodeCollection)
                    NodeCollection NodeColl = (NodeCollection)evtArgs.Elements;
                    foreach (Node N in NodeColl)
                       // Customizing Nodes Line Color and width
                        N.LineStyle.LineColor = Color.Red;
                        N.LineStyle.LineWidth = 2;
                    Node Nod = (Node)evtArgs.Element;
                    Nod.LineStyle.LineColor = Color.Red;
                    Nod.LineStyle.LineWidth = 2;


' Registering NodeCollectionChanged Event
Private diagram2.EventSink.NodeCollectionChanged += AddressOf EventSink_NodeCollectionChanged
' Customizing the Appearance of the node
Private Sub EventSink_NodeCollectionChanged(ByVal evtArgs As CollectionExEventArgs)
   If TypeOf evtArgs.Elements Is NodeCollection OrElse TypeOf evtArgs.Element Is Node Then
    If TypeOf evtArgs.Elements Is NodeCollection Then
     Dim NodeColl As NodeCollection = CType(evtArgs.Elements, NodeCollection)
     For Each N As Node In NodeColl
        ' Customizing Nodes Line Color and width
      N.LineStyle.LineColor = Color.Red
      N.LineStyle.LineWidth = 2
     Next N
     Dim Nod As Node = CType(evtArgs.Element, Node)
     Nod.LineStyle.LineColor = Color.Red
     Nod.LineStyle.LineWidth = 2
    End If
   End If
End Sub



2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
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