public static void OpenBehaviorForElement(EA.Repository repository, EA.Element el) { // find the diagram if (el.Diagrams.Count > 0) { // get the diagram var dia = (EA.Diagram)el.Diagrams.GetAt(0); // open diagram repository.OpenDiagram(dia.DiagramID); } // no diagram found, select element repository.ShowInProjectView(el); }