Vertex Visual in WPF

Apr 20, 2009 at 7:14 AM
Is it possible to replace/set the way vertices are drawn in the WPF NodeXLControl? I would like to supply to Visual/Control myself instead of using the predefined set of shapes.
Apr 20, 2009 at 3:40 PM
You can download the source code, then modify or replace Microsoft.NodeXL.Visualization.Wpf.VertexDrawer.  I don't think you can do it without the source code.

A previous NodeXL architecture used plug-in, interface-based drawing components.  That complicated the design considerably, however, and we had neither the testing resources to verify that the pluggability actually worked, nor the time to fix the problems that arose in a plug-in environment.  When I rewrote the visualization layer for WPF, I removed the plug-in feature in favor of a much simpler architecture.

-- Tony
Apr 20, 2009 at 4:38 PM
I see. If I do end up modifying the VertexDrawer couldn't it be made in a similar way as one sets a per vertex image today?

Also, unrelated, when I use the Zoom functionality (zoom > 1.0) is there a way to tell the control where to position the viewport? I now this can be done by using the mouse (dragging) the graph, is there a way to do it programatically?
Apr 20, 2009 at 5:13 PM
You mean by storing a Visual in the vertex's metadata and then drawing the Visual instead of a shape?  Yes, I guess you could do that.  Note, however, that GraphDrawingContext maintains a dictionary of VertexDrawingHistory objects that remember how vertices were drawn.  When drawing edges, these history objects are used to quickly determine where to put the edge endpoints.  If you expand the vertex drawing capabilities, you will have to adjust the history mechanism as well.

I didn't expose any viewport properties.  If you want to position the viewport, see the protected NodeXLControl.TranslateTransformForRender property and CheckForTranslationDragOnMouseMove() method.  Please note that the transforms responsible for zooming, positioning, and scaling are interdependent and require care if any changes are made.

-- Tony