We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

node filled color will be changed for clicked node and their parent node

Hi,

I am drawing a Flow Chart using Essential Diagram ASP.NET control. when I click on the node, the node filled color will be changed for clicked node and their parent node(may be start node). Please let me know whether it is possible or not.

Thanks in advance.



1 Reply

BM Bala Murugan A.S Syncfusion Team February 16, 2011 05:44 AM UTC

Hi Raja,

Thank you for your interest in Syncfusion Products,

We glad to inform you that we have achieve your requirement and the same can be downloaded from the below link.
NodeHighlight1293097900.zip

In the above sample if you click any of the node then path from clicked node to start node will be highlighted.
Please refer the below code snippet to achieve this.

[C#]

this.DiagramWebControl1.NodeClick += new Syncfusion.Web.UI.WebControls.Diagram.NodeClickEventHandler(DiagramWebControl1_NodeClick);

void DiagramWebControl1_NodeClick(object sender, Syncfusion.Web.UI.WebControls.Diagram.NodeClickEventArgs e)
{
Node clickNode=e.Node;
if (clickNode != null && clickNode is FilledPath || clickNode is ConnectorBase)
{
foreach (Node modelNode in this.DiagramWebControl1.Model.Nodes)
{
if (modelNode is ConnectorBase)
{
((ConnectorBase)modelNode).LineStyle.LineColor = Color.DarkBlue;
((ConnectorBase)modelNode).LineStyle.LineWidth = 1f;
}
if (modelNode is FilledPath)
((FilledPath)modelNode).FillStyle.Color = Color.PowderBlue;
}

if (clickNode is FilledPath || clickNode is ConnectorBase)
HighLightNode(clickNode);
}
}

private void HighLightNode(Node HNode)
{
IGraphNode thisNode = HNode as IGraphNode;
((FilledPath)thisNode).FillStyle.Color = Color.Red;

if (thisNode != null)
{
ICollection edgesLeaving = thisNode.EdgesEntering;
if (edgesLeaving != null)
{
foreach (IGraphEdge curEdge in edgesLeaving)
{
// Get from IGraphEdge link.
ConnectorBase link = curEdge as ConnectorBase;
link.LineStyle.LineColor = Color.HotPink;
link.LineStyle.LineWidth = 2f;
Node node = link.FromNode as Node;
HighLightNode(node);
}
}
}
}

Please let me know your concerns.

Regards,
Bala Murugan A.S


Loader.
Live Chat Icon For mobile
Up arrow icon