Diagram interactivity

Aug 11, 2011 at 2:15 PM

Is it possible to interact with the different elements of the graph?  As the example appears as a static image - I am itnerested in behaviour similar to Graph# where i can have highlighting and tooltips for the different nodes and edges?

Aug 11, 2011 at 10:03 PM
Edited Aug 11, 2011 at 10:04 PM

Yes, it's possible. In the example, a static image is contained in the DataTemplate for the Person class (the type of graph nodes). One can edit this DataTemplate and add a tooltip or anything that can be done in WPF. Nodes of the same graph can be of different type: thus different DataTemplates. All the other elements of the graph have their view models and their appearance can be changed by editing the DataTemplate of the view model. The example contains DataTemplates for all the elements: edges, labels, sub-graphs, ... (But remember: if some graphical effects causes a change of node's size, the graph won't be re-layouted. Re-layouting happens only when the Graph dependency property is changed).

Hope this helps.

P.S.: I have added a new wiki-page about customization of graph elements.

Aug 11, 2011 at 10:33 PM

It does indeed thanks.

You might want to stick some stuff in the example for your next release - changing colour when someone mouses over always goes down well.

Aug 12, 2011 at 12:37 AM

Thank you for a suggestion. At the moment Patterns4Net (Architecture Explorer) might serve as a quite more complex example of Graphviz4Net usage, maybe too much complex I am afraid, but it does what you wanted: it adds a shade when mouse is over a node, one can click or double-click nodes (and it does some action in response), there are several types of edges (dotted, solid, ...), etc. 

(There is a screenshot from Patterns4Net on the homepage of Graphviz4Net in the bottom of the page. Unfortunately, I can't find enough time to create a proper presentation for Patterns4Net)