microsoft / automatic-graph-layout

A set of tools for graph layout and viewing
Other
1.35k stars 304 forks source link

Clicking on VEdges and VLabels? #261

Closed rurounijones closed 3 years ago

rurounijones commented 3 years ago

I wish to attach click events to VLabels and VEdges as I can with VNode in WpfGraphControl

            graphViewer.MouseDown += (s, ev) =>
            {
                if (graphViewer.ObjectUnderMouseCursor is VNode node)
                {
                    Do.Stuff(node) // Works
                }
                else if (graphViewer.ObjectUnderMouseCursor is VLabel label 
                {
                    Do.Stuff(label) // does not work because we cannot check if class is VLabel above.
                }
            };

However VLabel and Vedge being internal means we cannot use them in the graphViewer.ObjectUnderMouseCursor is VLabel check.

How can we enable mouse clicking on VLabel and VEdge ?

rurounijones commented 3 years ago

And as always after hours of searching I find the answer 10 seconds after making a public post. use DrawingObject

graphViewer.ObjectUnderMouseCursor.DrawingObject is Labell