This documentation is archived and is not being maintained.

ShapeElement.FixUpChildShapes Method

Creates or adjusts the child shapes that should be created when a model element is created or updated. Called by Diagram.FixUpDiagram().

Namespace:  Microsoft.VisualStudio.Modeling.Diagrams
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.Diagrams (in Microsoft.VisualStudio.Modeling.Sdk.Diagrams.dll)

public virtual ShapeElement FixUpChildShapes(
	ModelElement childElement


Type: Microsoft.VisualStudio.Modeling.ModelElement

The new or re-parented model.

Return Value

Type: Microsoft.VisualStudio.Modeling.Diagrams.ShapeElement
The new or updated child shape; otherwise, null, if no child shape was configured.

An instance of a domain class in the model can be displayed by a shape on the diagram, according to the Diagram Element Maps specified in the DSL Definition. When a domain class instance is added to the model, this method is called to create the necessary shape or shapes. Less typically, this method is also called when the embedding relationship of an instance is changed: this can happen for example if the user cuts and pastes an element, or if an element is dragged from one container to another.

This method is called by FixUpDiagram(ModelElement, ModelElement) to provide the opportunity to create and/or configure child shapes in response to addingthe specified element to the model or changing its parent.

You can override this method to modify the default behavior. You can alternatively override various methods that are called by FixupChildShapes(). Most of these methods are overridden in your shape class and are determined by its Diagram Element Map in the DSL Definition:

  • ShouldAddShapeForElement(ModelElement) – to determine whether a child should be added for the new model element.

  • CreateChildShape(ModelElement) – to construct a new shape for the domain class instance, if it does not already exist

  • ChooseParentShape – typically this shape

  • ChooseRelationship – to determine whether the child shape should be a in the Nested Child Shapes or Relative Child Shapes

  • OnChildConfiguring – called immediately after the shape becomes a child of this ShapeElement, but before its position has been set.

  • OnChildConfigured – called after the child shape’s position has been set

  • childShape.OnBoundsFixup() – called after the child’s position has been set to allow it to adjust its bounds