Search code examples
wpfvb.netgraph-sharp

Get vertex value on vertex click


I've added vertex double click event by

For Each v In GraphSimple1.graphlayout.Children
     If TypeOf v Is VertexControl Then
         AddHandler TryCast(v, VertexControl).MouseDoubleClick, AddressOf v_MouseDoubleClick
     End If
Next v

it Works well but how can i get vertex value which i've clicked


Solution

  • Private Sub v_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        MessageBox.Show(Directcast(sender , VertexControl).ID)
    End Sub
    

    sender is your VertexControl so need to cast it to type VertexControl and can use it.