Create Nested diagram

May 6, 2013 at 10:51 AM
Edited May 6, 2013 at 10:55 AM
Hello all

It's Possible to create 2 diagram or more it's related with other diagram when i click one shape on diagram and appears another diagram which related with shape i click thanks.

Best Regards

May 6, 2013 at 12:59 PM
Hello Jupiter,

it's not possible to nest diagrams inside other diagrams, but you can handle the Display.ShapeClick event and change the displayed diagram whenever the user clicks one of your 'trigger shapes'.
May 6, 2013 at 6:15 PM
thank you very much KurtHolzinger for replay my message,can you give simple example how to get each information if in diagram have many shape?
May 8, 2013 at 7:22 AM
Basically, you can react on the ShapeClick event of the Dataweb.NShape.WinFormsUI.Display component. I thought of storing the name of the target diagram in the shape's Tag property assuming that you are creating your diagrams with code.
void Initialize() {
    display1.ShapeClick += new EventHandler<Dataweb.NShape.Controllers.DiagramPresenterShapeClickEventArgs>(display1_ShapeClick);

void display1_ShapeClick(object sender, Dataweb.NShape.Controllers.DiagramPresenterShapeClickEventArgs e) {
    if (e.Shape != null && e.Shape.Tag is string) {
        // Get diagram name from Tag property
        string diagramName = (string)e.Shape.Tag;
        Diagram diagram = project1.Repository.GetDiagram(diagramName);
        display1.Diagram = diagram;
Important note:
The contents of the Tag property is temporary not will not be stored in the Repository.

If you need to save and load the click target, you can derive your own shapes from the existing ones. You have to
  • add a property and a field for the target diagram name
  • 'override' the static method "GetPropertyDefinitions":
    new public static IEnumerable<EntityPropertyDefinition> GetPropertyDefinitions(int version) {
        foreach (EntityPropertyDefinition propertyInfo in PathBasedPlanarShape.GetPropertyDefinitions(version))
            yield return propertyInfo;
        yield return new EntityFieldDefinition("TargetDiagramName", typeof(string));
  • override the protected methods LoadFieldsCore and SaveFieldsCore
    protected override void LoadFieldsCore(IRepositoryReader reader, int version) {
        base.LoadFieldsCore(reader, 1);
        this.targetDiagramName = reader.ReadString();

    protected override void SaveFieldsCore(IRepositoryWriter writer, int version) {
        base.SaveFieldsCore(writer, version);
See documentation of "NShapeLibraryInitializer" for an example on how to create your own shape library.
May 10, 2013 at 9:09 AM
Thanks you very much mr kurt