ShapeDescription.CreateSvgShape(String, String, Stream, Boolean, Func<Size, IEnumerable<Point>>, String, String) Method

Creates a diagram shape from a stream that contains an SVG image.

Namespace: DevExpress.Diagram.Core

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


public static ShapeDescription CreateSvgShape(
    string shapeId,
    string name,
    Stream svgStream,
    bool isQuick = false,
    Func<Size, IEnumerable<Point>> getConnectionPoints = null,
    string backgroundColorCode = null,
    string strokeColorCode = null


Name Type Description
shapeId String

A string value that identifies the shape.

name String

A string value that is the name of the shape.

svgStream Stream

A System.IO.Stream object that contains the SVG image.

Optional Parameters

Name Type Default Description
isQuick Boolean


true to display the shape within the Quick Shapes category of the Shapes toolbox; otherwise, false.

getConnectionPoints Func<Size, IEnumerable<Point>>


A function that specifies the coordinates of connection points.

backgroundColorCode String


A string value that represents the code of the color to be swapped with the theme’s background color.

strokeColorCode String


A string value that represents the code of the color to be swapped with the theme’s foreground color.


Type Description

A ShapeDescription object that represents the shape.


The following snippet illustrates how to create an SVG shape with a connection point in the center and add it to the toolbox.

var stencil = new DevExpress.Diagram.Core.DiagramStencil("OfficeStencil", "Office Shapes");
using (System.IO.FileStream stream = System.IO.File.Open("..\\..\\Armchair.svg", System.IO.FileMode.Open)) {
    var shapeDescription = DevExpress.Diagram.Core.ShapeDescription.CreateSvgShape("Armchair", "Armchair", stream, false, (s) => new[] { new System.Windows.Point(s.Width / 2, s.Height / 2) });
See Also