This project is read-only.

Vertex highlighting

Apr 17, 2013 at 8:31 PM
Edited Apr 18, 2013 at 8:50 AM
Hello everybody, several days ago I faced a problem that I have to visualize one piece of data as a graph. The project is written on C# and it's a WPF application, so I tried to find a control/library which would be able to help me doing this work, and GraphSharp is the most referred one. Using several simple tutorials that was mentioned on the homepage of this project, I create a data structure (in the way it was described here) that was visualized successfully, but there are questions which couldn't be answered by me so easy because of documentation shortage and my little experience.
1) How can I highlight elements by mouse click and freeze this highlighting till the next click?
2) What should I do to divide vertices on classes different in style?
Apr 18, 2013 at 10:38 PM
Hi, you can use SelectedVertex implementation to get mouse-selected vertex,from this thread:

To manually highlight vertex and all related vertexes, i suppose you can use: GraphElementBehaviour.SetHighlightTrigger(vertex, true)

To be able to style vertexes differently, you can use many approaches, for ex. derive new class from VertexControl and add separate template for that class. Or you can assign templates manually based on Vertex property data (which stores your custom vertex).

Honestly, in my opinion, Graph# is completely outdated and lacks essential documentation. It is also not very flexible "out-of-the-box". Right now i'm working on a similar library based on Graph# algorithms and i hope i can share it with the community soon.