Я пробую библиотеку Graph # (graphsharp), и мне нужно сделать вершины, которые я добавляю, неподвижными.Единственная вещь, которая, кажется, делает трюк, это делает свойство GraphLayout IsEnabled ложным.Есть ли другой способ добиться этого?
Также, как я могу взаимодействовать, например, при щелчке по вершине.Документация для библиотеки практически отсутствует.
<Window x:Class="GraphSharpDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:graphsharp="clr-namespace:GraphSharp.Controls;assembly=GraphSharp.Controls"
xmlns:zoom="clr-namespace:WPFExtensions.Controls;assembly=WPFExtensions"
xmlns:local="clr-namespace:GraphSharpDemo"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525"
x:Name="root">
<Grid>
<zoom:ZoomControl>
<graphsharp:GraphLayout x:Name="graphLayout"
Graph="{Binding ElementName=root,Path=GraphToVisualize}"
LayoutAlgorithmType="Tree"
OverlapRemovalAlgorithmType="FSA"
HighlightAlgorithmType="Simple">
</graphsharp:GraphLayout>
</zoom:ZoomControl>
</Grid>
public partial class MainWindow : Window
{
private IBidirectionalGraph<object, IEdge<object>> _graphToVisualize;
public IBidirectionalGraph<object, IEdge<object>> GraphToVisualize
{
get
{
return _graphToVisualize;
}
}
public MainWindow()
{
CreateGraphToVisualize();
InitializeComponent();
}
private void CreateGraphToVisualize()
{
var g = new BidirectionalGraph<object, IEdge<object>>();
Ellipse[] ellipses = new Ellipse[5];
Polygon[] triangles = new Polygon[5];
for (int i = 0; i < 5; i++)
{
ellipses[i] = CreateCircle();
triangles[i] = CreateTriangle(25, 50, 50, 0, 0, 0);
g.AddVertex(triangles[i]);
g.AddVertex(ellipses[i]);
}
g.AddEdge(new Edge<object>(triangles[0], triangles[1]));
g.AddEdge(new Edge<object>(triangles[1], triangles[2]));
g.AddEdge(new Edge<object>(triangles[2], triangles[3]));
g.AddEdge(new Edge<object>(triangles[1], triangles[4]));
g.AddEdge(new Edge<object>(triangles[3], ellipses[0]));
g.AddEdge(new Edge<object>(triangles[3], ellipses[1]));
g.AddEdge(new Edge<object>(triangles[4], ellipses[2]));
g.AddEdge(new Edge<object>(triangles[4], ellipses[3]));
g.AddEdge(new Edge<object>(triangles[4], ellipses[4]));
_graphToVisualize = g;
}
}