How do I set layout algorithm properties on the GraphControl

Nov 20, 2009 at 5:11 PM

I have a very basic question that I'm almost too embarrassed to ask... Having used the sample application to experiment with the various algorithms and parameters, I need to set up my GraphControl to match my chosen settings. I want to use the EfficientSugiyama algorithm and set the Layer and Vertex gaps, and also choose Orthogonal edge routing, but I can't for the life of me work out how to do this in XAML.

Can someone post a sample bit of XAML that sets these kinds of parameters?

Thanks,

Graeme.

 

Developer
Nov 23, 2009 at 4:12 PM

I GraemeF do not worry about "stupid questions" we are here to learn and help other developers.

Try with this XAML code-snippet:

            <Sample:MyGraphLayout x:Name="layout"
                                  LayoutAlgorithmType="EfficientSugiyama "
                                  Graph="{Binding}">
                <Sample:MyGraphLayout.LayoutParameters>
                    <sugiyama:EfficientSugiyamaLayoutParameters
                        LayerDistance="2.0"
                        VertexDistance="2.3"
                        EdgeRouting="Orthogonal">
                    </sugiyama:EfficientSugiyamaLayoutParameters>
                </Sample:MyGraphLayout.LayoutParameters>
            </Sample:MyGraphLayout>

To be able to access the EfficientSugiyamaLayoutParameters you have to add at the top of your code the reference to the correct namespace. In this case
	xmlns:sugiyama="clr-namespace:GraphSharp.Algorithms.Layout.Simple.Hierarchical;assembly=GraphSharp"

Hoe this help
Let us know

badang


 

 

 

Nov 24, 2009 at 3:48 PM

That worked a treat! Thanks very much for your help. :)