Diagram read only

Hi

Hopefully a simple one.

I've managed to find a fair few things out by Googling and also looking through the knowledgebase and forum.

I can see you have an option to get the parent node details. However, as with Treeview I cannot find a way to detect if a node has children.

I'm currently here in Vb

 Dim NodeColl As NodeCollection = Diagram1.Model.Nodes



        For Each nod As Node In NodeColl

            If TypeOf nod Is OrgLineConnector Then
                ' MsgBox(nod.Name)

            Else



                Dim nodrect As Rectangle = nod

HERE I NEED TO DETECT IF THE NODE HAS NO CHILDREN

                If nodrect.Name Like ("*4*") Then
                    nodrect.FillStyle.Color = Color.Orange
                End If
            End If

        Next


Basically if an 'endnode' has a certain value I want to change the color.


Many thanks in advance

3 Replies

NG Naganathan Ganesh Babu Syncfusion Team July 23, 2018 07:33 AM UTC

Hi Steve, 
 
Thanks for contacting Syncfusion support. 
 
We suggest you to use Node’s Edges/EdgesLeaving/EdgesEntering properties to know which parent/children details.   
  
Edges – To get all the connectors to connected with the node.  
EdgesLeaving – To get all the connectors which are leaving from the nodes.  
EdgesEntering – to get all the connectors which are entering to the nodes.  
 
Also, you can use Node’s “EdgesLeaving” property to check if the current node is contain children or not. Please refer to the below code example. 
 
Code example: 
 
[VB] 
 
For Each node As Node In diagram1.Model.Nodes 
If Not(TypeOf node Is ConnectorBase) AndAlso node.EdgesLeaving.Count = 0 Then 
 TryCast(node, FilledPath).FillStyle.Color = Color.Orange 
End If 
Next node 
 
Regards, 
 
Naganathan K G 



ST Steve July 23, 2018 07:06 PM UTC

Naganathan

That makes sense.

Works a treat

Thanks.


NG Naganathan Ganesh Babu Syncfusion Team July 24, 2018 10:54 AM UTC

Hi Steve, 
 
Thanks for your update. 
 
We are happy to hear that your problem is resolved. Please let us know if you need any further assistance. 
 
Regards, 
 
Naganathan K G 


Loader.
Up arrow icon