Category / Section
How to show assistants to the parent node of the organization layout in WPF Diagram (SfDiagram)?
1 min read
A node can be specified as an assistant of its parent by adding it to the Assistants property of the LayoutInfoArgs class argument in the GetLayoutInfo event of WPF Diagram (SfDiagram). This event can be used to configure every subtree of the layout.
SfDiagram diagram = new SfDiagram(); (diagram.Info as IGraphInfo).GetLayoutInfo += GetLayoutInfo; void GetLayoutInfo(object sender, LayoutInfoArgs args) { if (diagram.LayoutManager.Layout is DirectedTreeLayout) { DirectedTreeLayout layout = (diagram.LayoutManager.Layout as DirectedTreeLayout); if (layout.Type == LayoutType.Organization) { if (args.Item is INode) { Employee emp = (args.Item as INode).Content as Employee; if (emp.Designation.ToString() == "Managing Director") { args.Assistants.Add(args.Children[0]); args.Children.Remove(args.Children[0]); } } } } }