This documentation is archived and is not being maintained.

Decorator Class

When overridden in a derived class, represents a decorator element in the diagram.

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

public abstract class Decorator

Decorators are wrapped around other elements in the diagram to format them.

To guarantee that inner decorators do not overlap, you should anchor them to the diagram. To anchor decorators, first override [InitializeShapeFields] to call the base. Then use [FindShapeField] to locate the shape field to which you want to apply the decorator, and then call the appropriate anchoring method.

In the following example, the Name decorator is anchored to the right side of the Name2 decorator.

partial class WizardPageShape
{
    protected override void  InitializeShapeFields(IList<Microsoft.VisualStudio.Modeling.Diagrams.ShapeField> shapeFields)
        {
            base.InitializeShapeFields(shapeFields);
            ShapeField name = ShapeElement.FindShapeField(shapeFields, "Name");
            ShapeField name2 = ShapeElement.FindShapeField(shapeFields, "Name2");
            name.AnchoringBehavior.SetLeftAnchor(name2, AnchoringBehavior.Edge.Right, 0.01);
        }
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: