在我们的项目中,我们使用 GraphSharp 库。当我们想从图中删除所有边和顶点时,我们遇到了一些问题。
在每个示例中,在 xaml 中都有类似的东西
<zoom:ZoomControl Grid.Row="1" Zoom="0.2" ZoomBoxOpacity="0.5" Background="#ff656565">
<toProjectGraph:EntityGraphLayout x:Name="graphLayout" Margin="10"
Graph="{Binding Path=GraphViewModel.EntityGraph}"
LayoutAlgorithmType="{Binding Path=GraphViewModel.LayoutAlgorithmType, Mode=OneWay}"
OverlapRemovalAlgorithmType="FSA"
HighlightAlgorithmType="Simple"
/>
</zoom:ZoomControl>
xaml 创建我们类的实例EntityGraphLayout
并使用它来可视化所有内容。
是否有可能以某种方式将此实例“绑定”EntityGraphLayout
到我们视图模型中的某个属性,以便我们可以在我们的视图模型代码中引用它?
或者也许有一种方法可以创建此类的实例并告诉 xaml 从某个路径获取对对象的引用。