How to highlight a subgraph in the original graph in GraphX for .NET?

88 views Asked by At

I have an original graph built in GraphArea (WPF) and its subgraph as a list of vertices and edges. I want to highlight this subgraph on the original graph. But the method HighlightBehaviour.SetHighlighted(DependencyObject obj, bool value) requires passing elements of the <DependencyObject> type to it. Can you tell me how I can find them?

1

There are 1 answers

1
user1720736 On BEST ANSWER

Eureka!

var listE = new List<IGraphControl>();
listE.AddRange(GraphArea.EdgesList.Where(a => subGraph.Edges.Contains(a.Key)).Select(a => a.Value));

foreach (var edge in listE)
{
    HighlightBehaviour.SetHighlighted((DependencyObject)edge, true);
}

var listV = new List<IGraphControl>();
listV.AddRange(GraphArea.VertexList.Where(a => subGraph.Vertices.Contains(a.Key)).Select(a => a.Value));
foreach (var vertx in listV)
{
    HighlightBehaviour.SetHighlighted((DependencyObject)vertx, true);
}