private async void InteractiveEdgeCreated(object sender, EdgeEventArgs e) { INode node = (INode)e.Item.TargetPort.Owner; int layer = GetLayer(node); IGraph graph = graphControl.Graph; // set the correct color for the layer graph.SetStyle(node, new ShinyPlateNodeStyle { Brush = NodePlacerPanel.LayerBrushes[layer % NodePlacerPanel.LayerBrushes.Length] }); // and the correct placer for the layer INodePlacer placer = null; if (layer >= nodePlacerPanel.NodePlacers.Count) { nodePlacerPanel.NodePlacers.Add(NodePlacerConfigurations.None); } else { INodePlacerConfiguration nodePlacerConfiguration = nodePlacerPanel.NodePlacers[layer].Configuration; placer = nodePlacerConfiguration.CreateNodePlacer(); } placers[node] = placer ?? new DefaultNodePlacer(); // execute the layout await ApplyLayout(); // set the placer panel to the node's layer nodePlacerPanel.Level = layer; }