Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DiagramOptionsBehavior.Stencils Property

Provides access to the collection of available stencils.

Namespace: DevExpress.XtraDiagram.Options

Assembly: DevExpress.XtraDiagram.v24.2.dll

NuGet Package: DevExpress.Win.Diagram

#Declaration

[Browsable(false)]
[DefaultValue(null)]
public virtual DiagramStencilCollection Stencils { get; set; }

#Property Value

Type Default Description
DevExpress.Diagram.Core.DiagramStencilCollection null

A DevExpress.Diagram.Core.DiagramStencilCollection object that is the collection of available stencils.

#Property Paths

You can access this nested property as listed below:

Object Type Path to Stencils
DiagramControl
.OptionsBehavior .Stencils

#Remarks

Use the Stencils property to register new or remove the default stencils.

See the example below.

var svgStencil = new DiagramStencil("SVGStencilId", "SVGStencilName");
using(var svgStream = File.OpenRead("Shape.svg")) {
    var svgShape = ShapeDescription.CreateSvgShape("SVGShapeId", "SVGShapeName", svgStream);
    svgStencil.RegisterShape(svgShape);
}
diagramControl.Stencils = new DiagramStencilCollection(svgStencil, BasicShapes.Stencil);

If the Stencils property is set to null, the diagram toolbox loads its stencils from the DiagramToolboxRegistrator.Stencils static collection.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Stencils property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also