GraphArea class serves as the layout field there all vertices and edges are placed and displayed. This is the main operational object of the GraphX library. All most important operations are done using this class.
It is derived from GraphAreaBase class wich serves as the template-less base that contains events, methods and properties that are most often used by child objects outside of templated class body.

PROPERTIES

AlgorithmFactory - gets algorithm factory class object that provides methods for creating all possible calculation algorithms and algorithm parameters.
public AlgorithmFactory<TVertex, TEdge, TGraph> AlgorithmFactory { get; }

AsyncAlgorithmCompute - gets or sets if all algorithms must be computed in a separate thread, leaving UI thread unlocked for user input.
public bool AsyncAlgorithmCompute { get; set; }

DefaultEdgeRoutingAlgorithm - gets or sets default edge routing algorithm that will be used to calculate edge route points if no external algorithm is defined. Available default algorithms are:
  • SimpleER
  • PathFinder
  • Bundling
  • None
Default value is None.
public EdgeRoutingAlgorithmTypeEnum DefaultEdgeRoutingAlgorithm { get; set; }

DefaulEdgeRoutingAlgorithmParams - gets or sets default edge routingl algorithm params that will be used with DefaultEdgeRoutingAlgorithm. If null value is specified then default values will be used. To get default params for selected algorithm please use factory method: GraphArea.AlgorithmFactory.CreateEdgeRoutingAlgorithm(EdgeRoutingAlgorithmTypeEnum newAlgorithmType, TGraph Graph, IDictionary<TVertex, Point> Positions, IDictionary<TVertex, Rect> Rectangles, IEdgeRoutingParameters parameters = null). Default value is null.
public IEdgeRoutingParameters DefaulEdgeRoutingAlgorithmParams { get; set; }

DefaultOverlapRemovalAlgorithm - gets or sets default overlap removal algorithm that will be used to justify vertex positions if no external algorithm is defined. Available default algorithms are:
  • FSA
  • OneWayFSA
  • None
Default value is FSA.
public OverlapRemovalAlgorithmTypeEnum DefaultOverlapRemovalAlgorithm { get; set; }

DefaultOverlapRemovalAlgorithmParams - gets or sets default overlap removal algorithm params that will be used with DefaultOverlapRemovalAlgorithm. If null value is specified then default values will be used. To get default params for selected algorithm please use factory method: GraphArea.AlgorithmFactory.CreateOverlapRemovalParameters(OverlapRemovalAlgorithmTypeEnum algorithmType). Default value is null.
public IOverlapRemovalParameters DefaultOverlapRemovalAlgorithmParams { get; set; }

DefaultLayoutAlgorithm - gets or sets default layout algorithm that will be used to calculate vertex positions if no external algorithm is defined. Available default algorithms are:
  • BoundedFR
  • Circular
  • CompoundFDP
  • EfficientSugiyama
  • Sugiyama
  • FR
  • ISOM
  • KK
  • LinLog
  • Tree
Default value is LinLog.
public LayoutAlgorithmTypeEnum DefaultLayoutAlgorithm { get; set; }

DefaultLayoutAlgorithmParams - gets or sets default layout algorithm params that will be used with DefaultLayoutAlgorithm. If null value is specified then default values will be used. To get default params for selected algorithm please use factory method: GraphArea.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum algorithmType). Default value is null.
public ILayoutParameters DefaultLayoutAlgorithmParams { get; set; }

DeleteAnimation - gets or sets visual controls delete animation. You can use AnimationFactory to create pre-built animations. Default value is Null.
public IOneWayControlAnimation DeleteAnimation { get; set; }

EdgeCurvingEnabled - gets or sets edge curving technique to be applied at the edge routing calculation process for smooth edge curves. Default value is False.
public bool EdgeCurvingEnabled { get; set; }

EdgeCurvingTolerance - gets or sets edge curving technique tolerance. This is roughly the length of each line segment in the polyline approximation to a continuous curve in WPF units. The smaller the number the smoother the curve, but slower the performance. Default value is 8.
public double EdgeCurvingTolerance { get; set; }

EdgeSelfLoopCircleOffset - gets or sets the self-looped edge offset from the corner of the vertex. Useful for custom vertex shapes. Default is 10,10.
public Point EdgeSelfLoopCircleOffset { get; set; }

EdgeSelfLoopCircleRadius - gets or sets the radius of the self-looped edges which are drawn in a circle. Default value is 20.
public double EdgeSelfLoopCircleRadius { get; set; }

EdgeShowSelfLooped - gets or set if the self-looped edges must be shown or hidden. Default value is True.
public bool EdgeShowSelfLooped { get; set; }

EdgesList - gets collection of the visual edge controls that is added to the GraphArea. Although it is possible to modify this collection manualy it is strongly advised not to do it unless you know what are you doing. That is because many library features relies on automated edge and vertex collection managment. TEdge is edge data object.
public Dictionary<TEdge, EdgeControl> EdgesList { get; }

EnableParallelEdges - Enables parallel edges calculation. All edges between the same nodes will be separated by ParallelEdgeDistance value. This is post-process procedure and it may be performance-costly. Default value is False.
public bool EnableParallelEdges { get; set; }

EnableWinFormsHostingMode - Gets or sets special mode for WinForms interoperability. Turning this on ensures that GraphX will work in WinForms project. Default value is False.
public bool EnableWinFormsHostingMode { get; set; }

ExternalOverlapRemovalAlgorithm - gets or sets external overlap removal algorithm that will be used instead of the default one to justify vertex positions. For additional info please read Using external calculation algorithms. Default value is null.
public IExternalOverlapRemoval<TVertex> ExternalOverlapRemovalAlgorithm { get; set; }

ExternalLayoutAlgorithm - gets or sets external layout algorithm that will be used instead of the default one to calculate vertex positions. For additional info please read Using external calculation algorithms. Default value is null.
public IExternalLayout<TVertex, TEdge, TGraph> ExternalLayoutAlgorithm { get; set; }

ExternalSettings - gets or sets external data object that can be used in user-defined operations. For example, it can store some config data that can be used in the custom visual templates. Default value is null.
public object ExternalSettings{ get; set; }

IsEdgeRoutingEnabled - gets if any edge routing algorithm has been used while graph generation.
public bool IsEdgeRoutingEnabled { get;  }

Graph - gets or sets data graph object that will be used for various GraphArea operations. You can use this property to manually assign graph data for ex. when using custom calculation algorithms. Normaly you don't need to modify this property manualy. Default value is null, auto assigned by GenerateGraph() method.
public TGraph Graph { get; set; }
    where TGraph : class, IBidirectionalGraph<TVertex, TEdge>

MoveAnimation - gets or sets vertex and edge move animation that will be performed on relayout operation. For additional info please read Visual controls animation. Default value is null.
public IMoveAnimation MoveAnimation { get; set; }

MouseOverAnimation - gets or sets visual controls mouse over animation. You can use AnimationFactory to create pre-built animations. Default value is Null.
public IBidirectionalControlAnimation MouseOverAnimation { get; set; }

ParallelEdgeDistance - Distance by which edges are parallelized if EnableParallelEdges is true. Default value is 5.
public int ParallelEdgeDistance{ get; set; }

SideExpansionSize - gets or sets additional free space from each side of the GraphArea. Created for scale animation to not being cut by area borders. Default value is 0.

StateStorage - get state storage class object that provides methods for saving and loading graph layout states. States are saved along with the all vertex and edge data objects.
public StateStorage<TVertex, TEdge, TGraph> StateStorage { get; }

UseNativeObjectArrange - Default value is True. If set to False it will use different coordinates handling that helps to soften vertex drag issues to the top and left area sides (best used with ZoomControl)

VertexList - gets collection of the visual vertex controls that is added to the GraphArea. Although it is possible to modify this collection manualy it is strongly advised not to do it unless you know what are you doing. That is because many library features relies on automated edge and vertex collection managment. TVertex is vertex data object.
public Dictionary<TVertex, VertexControl> VertexList { get; }

METHODS

AddVertex - adds VertexControl to GraphArea. Also modifies VertexList collection. TVertex is vertex data object.
public void AddVertex(TVertex it, IGraphControl ctrl)

AddEdge - adds EdgeControl to GraphArea. Also modifies EdgesList collection. TEdge is edge data object.
public void AddEdge(TEdge item, IGraphControl ctrl)

CancelRelayout - Cancels current async graph generation operation if async calculation is used overwise nothing happens.
public void CancelRelayout()

ClearLayout - clears graph layout from the all objects.
public void ClearLayout()

ExportAsPNG - exports current graph visual layout into the specified PNG file.
public void ExportAsPNG()

ExportAsImage - saves full graph view into the image file of the specified format. If useZoomControlSurface is set to true then zoom control content will be used as the source making the resulting image to draw graph as it is represented in zoom control using such modifiers as scaling and translation.
public void ExportAsImage(PrintHelper.ImageType itype, bool useZoomControlSurface = false, double dpi = PrintHelper.DefaultDPI, int quality = 100)

GenerateAllEdges - generates all visual edges for existing and valid vertices. Optionaly you can control initial visibility of the objects.
public void GenerateAllEdges(Visibility defaultVisibility = System.Windows.Visibility.Visible)

GenerateEdgesForVertex - generates visual edges of specified type for specified vertex control.
Optionaly you can control initial visibility of the objects.
public void GenerateEdgesForVertex(VertexControl vc, EdgesType edgeType, Visibility defaultVisibility = System.Windows.Visibility.Visible)

GenerateGraph - generates all visual objects and calculates its positions.
public void GenerateGraph(TGraph graph, bool generateAllEdges = false, bool autoAssignMissingDataID = true, bool dataContextToDataItem = true)
public void GenerateGraph(bool generateAllEdges = false, bool autoAssignMissingDataID = true, bool dataContextToDataItem = true)

GetRelatedControls - gets visual controls related to specified control using additional parameters. For example, you can get vertices that is connected by an edge or in/out e.dges for vertex. Note that IGraphControl objects are visual: VertexControl and EdgeControl.
public override List<IGraphControl> GetRelatedControls(IGraphControl ctrl, GraphControlType resultType = GraphControlType.VertexAndEdge, EdgesType edgesType = EdgesType.Out)

ComputeEdgeRoutesByVertex - compute and set edge routes for all edges of specified vertex control. VertexDataNeedUpdate - specifies if data such as vertex size or position must be updated before calculation.
public virtual void ComputeEdgeRoutesByVertex(VertexControl vc, bool VertexDataNeedUpdate = true)

GetVertexSizes - gets sizes of visual vertex controls that was already added into the GraphArea. Using VertexList property.
public Dictionary<TVertex, Size> GetVertexSizes()

GetVertexSizeRectangles - gets visual vertex size rectangles (can be used by some algorithms).
public Dictionary<TVertex, Rect> GetVertexSizeRectangles(IDictionary<TVertex, Point> positions, Dictionary<TVertex, Size> vertexSizes = null)

InsertEdge - inserts EdgeControl to GraphArea into specified position. Also modifies EdgesList collection. TEdge is edge data object.
public void InsertEdge(TEdge item, IGraphControl ctrl, int num = 0)

LoadFromFile - loads visual and data graph from the file. File can be saved using SaveIntoFile method.
public void LoadFromFile(string filename)

PreloadVertexes - loads all vertex data objects from graph parameter into the GraphArea visual vertices. This method can be used if you want to use external layout algorithm that needs visual vertex sizes. For ex, you will need to preload vertices, calculate sizes, set ExternalLayoutAlgorithm property using received sizes and then call GraphArea.RelayoutGraph() method.
Optionaly you can specify:
  • Main visual vertex that will utilize visual template named mainVertexTemplate if any was found in the GraphArea.Resources.
  • dataContextToDataItem parameter specifies that data vertex will be assigned to the DataContext property of all created vertices.
public void PreloadVertexes(TGraph graph, TVertex mainVertex = null, bool dataContextToDataItem = true)

PrintDialog - print current visual graph layout
public void PrintDialog(string description = "")

RelayoutGraph - performs relayout of the visual vertices and edges that was already added into the GraphArea. Optional parameter allow generate all possible edges.
public void RelayoutGraph(bool generateAllEdges = false)

RemoveAllEdges - removes all visual edge controls from GraphArea. Also modifies EdgesList collection.
public void RemoveAllEdges()

RemoveAllVertices - removes all visual vertex controls from GraphArea. Also modifies VertexList collection.
public void RemoveAllVertices()

RemoveControl - removes visual vertex or edge control from GraphArea. Also modifies VertexList or EdgesList collection.
public void RemoveControl(object data)

SaveIntoFile - saves visual and data graph into the file. File can be loaded using LoadFromFile method.
public void SaveIntoFile(string filename)

SetEdgesDashStyle - sets specified dash style for all edges on the graph.
public void SetEdgesDashStyle(EdgeDashStyle style)

SetVerticesDrag - Sets drag mode enabled/disabled for all vertices.
public void SetVerticesDrag(bool isEnabled, bool updateEdgesOnMove = false)

ShowAllEdgesArrows - sets the value that specifies if all edges arrows must be shown or hidden.
public void ShowAllEdgesArrows(bool value = true)

ShowAllEdgesLabels - sets the value that specifies if all edges labels must be shown or hidden.
        public void ShowAllEdgesLabels(bool value = true)

UpdateAllEdges - updates visual appearance (including route points recalculation) for all visual edges on the graph.
public void UpdateAllEdges()

ATTACHED PROPERTIES

GetX, GetY, SetX, SetY - gets or set specified coordinate for any DependencyObject that can be deployed into the GraphArea.Children collection. Usualy you don't have to use this manualy.
public static double GetX(DependencyObject obj)
public static void SetX(DependencyObject obj, double value)
public static double GetY(DependencyObject obj)
public static void SetY(DependencyObject obj, double value)

EVENTS

EdgeSelected - fired when visual edge control is clicked by mouse. Provides EdgeSelectedEventHandler params with EdgeControl that has been clicked.

VertexDoubleClick - fired when visual vertex control is double clicked by mouse. Provides VertexSelectedEventArgs params with VertexControl that has been clicked.

VertexSelected - fired when visual vertex control is clicked by mouse. Provides VertexSelectedEventArgs params with VertexControl that has been clicked.

VertexMouseEnter - fired when mouse pointer enters visual vertex control.

VertexMouseMove - fired when mouse pointer moved over the visual vertex control.

VertexMouseLeave - fired when mouse pointer leaves visual vertex control.

LayoutCalculationFinished - fired when layout algorithm calculation is finished.

OverlapRemovalCalculationFinished - fired when overlap removal algorithm calculation is finished.

EdgeRoutingCalculationFinished - fired when edge routing algorithm calculation is finished.

RelayoutFinished - fired when relayout operation is finished.

GenerateGraphFinished - fires when GenerateGraph() method is worked

Last edited Nov 7, 2013 at 6:37 AM by panthernet, version 10