Skip to main content

DiagramStencil.RegisterShape(ShapeDescriptionBase) Method

Adds the specified shape to the stencil.

Namespace: DevExpress.Diagram.Core

Assembly: DevExpress.Diagram.v26.1.Core.dll

NuGet Package: DevExpress.Diagram.Core

Declaration

public void RegisterShape(
    ShapeDescriptionBase shape
)

Parameters

Name Type Description
shape ShapeDescriptionBase

A ShapeDescriptionBase descendant representing the shape to add to the stencil.

Remarks

The example below illustrates how to add an SVG shape to a stencil.

//create or get the stencil you want to add your SVG to
    var stencil = DiagramToolboxRegistrator.GetStencil("SvgShapes");

    //open the file here
    using (Stream file = File.OpenRead(filePathToSVGFile)) {
        String id = "SVGid";
        String name = "SVGname";

        //create your shapeDescription with the SVG
        var shapeDescription = ShapeDescription.CreateSvgShape(id, name, file, false);

        //add the shapeDescription to your stencil
        stencil.RegisterShape(shapeDescription);
    }

To register custom diagram items, use the DiagramStencil.RegisterTool method.

See Also