Programmatically change selected edge color

Jan 20, 2012 at 2:27 PM

Hi all,

i found these method "graphLayout.HighlightEdge(Edge<object, object> edge, Object highlightInfo)" and "graphLayout.RemoveHighlightFromEdge(Edge<object, object> edge)"  to change selected edge color, and it works.

But the colors I want are different from Black and Silver that these methods produce. So i ask is possible to change these colors?

Or are there another functions to call or xaml to write to programmatically change the color of an edge?


Jan 26, 2012 at 8:09 PM

Find it!

Probably it can be done by xaml code, but i don't know WPF very well; so i found a solution via c# code.

If for example e1 is the variable that contain edge to modify color, and Acqua is the color you want..:

EdgeControl ec1 = graphLayout.GetEdgeControl(e1);
Brush pp1 = new SolidColorBrush(Colors.Aqua);
ec1.Foreground = pp1;

Apr 5, 2012 at 11:48 PM

You can also define different styles for EdgeControl in XAML as resources.

Then you just get an EdgeControl object for the targeted edge and change its Style property.