private void Repository_ShapesInserted(object sender, RepositoryShapesEventArgs e) { // Insert shapes that are not yet part of its diagram foreach (Shape shape in e.Shapes) { Diagram d = e.GetDiagram(shape); if (d != null && !d.Shapes.Contains(shape)) d.Shapes.Add(shape); } }