[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Collapse]Diagram Control
    Getting Started
   [Collapse]Diagram Control
     Diagram Designer Control
     Canvas
     Shapes Panel
     Properties Panel
     Ribbon
     Bottom Panel
     Page Setup Dialog Window
     Print Preview
     Pan and Zoom Panel
     DefaultBarItemNames
   [Expand]End-User Interaction
   [Expand]Diagram Items
   [Expand]Automatic Layout
   [Expand]Data Binding
    Themes and Styles
    Printing and Exporting
    Saving and Loading Diagrams
   [Expand]Examples
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Shapes Panel

The Shapes panel displays available Shapes that users can drag to the Canvas.

Users can click the Expand/Collapse buttons to toggle between full and compact modes. To change the display mode in code-behind, use the DiagramControl.ToolboxVisibility property. The image below shows the panel in compact mode.

Users can select the Shapes Panel item in the Ribbon UI to show or hide the Shapes panel.

Shapes are organized into categories. The Quick Shapes category contains shapes whose ShapeDescription.IsQuick property is set to true. Set the DiagramControl.ShowQuickShapes property to false to hide the Quick Shapes category.

The search form at the top allows users to search a shape by its name. When the user types in a search string, shapes whose name does not match the string are filtered out. The dropdown button shows the list of the most recently used (MRU) search strings.

Expanded Customization

Shapes in the Shapes panel are grouped by stencils. Use the DiagramControl.Stencils property to modify stencils for a specific DiagramControl (see DiagramControl). The following example shows how to create a stencil with an SVG shape:

To modify stencils for all diagrams in your application, use the DiagramToolboxRegistrator (see DiagramToolboxRegistrator) static class's DiagramToolboxRegistrator.RegisterStencil and DiagramToolboxRegistrator.UnregisterStencil methods. The example below illustrates how to remove all the default stencils from the Shapes panel.

Use FactoryItemTool to Add Items

The FactoryItemTool (see FactoryItemTool) class allows you to add the DiagramShape (see DiagramShape), DiagramImage (see DiagramImage), DiagramContentItem (see DiagramContentItem), DiagramContainer (see DiagramContainer), and DiagramConnector (see DiagramConnector) items to stencils. The code snippet below illustrates how to add a new stencil with a raster image.

Modify Existing Items

Use the DiagramControl.ItemInitializing event to modify newly created diagram items and toolbox items. The example below illustrates how to change the border thickness for the Rectangle shape.

Remove Stencils

To remove a stencil from the Shapes panel, use the DiagramToolboxRegistrator (see DiagramToolboxRegistrator) static class's DiagramToolboxRegistrator.UnregisterStencil method:

To remove all stencils except those specified, initialize a new DiagramStencilCollection and set it as the DiagramControl.Stencils property value:

Remove Shapes From Stencils

Use the DiagramStencil.UnregisterShape method to remove a shape from a stencil. See the example below.

Create Hidden Stencils

Set the isVisible DiagramStencil (see DiagramStencil) constructor parameter to false to create hidden stencils. Hidden stencils are not shown in the Shapes panel, but their shapes can be used in the diagram. See the example below.

Create a Custom Toolbox

Use the DevExpress.Diagram.Core.DiagramToolBehavior class to create custom toolbox items based on standard controls. Attach the DiagramToolBehavior to a UI element that serves as a container item. Then bind the DiagramToolBehavior.DiagramTool to an instance of a DevExpress.Diagram.Core.ItemTool descendant.

A sample project is available in the GitHub repository: https://github.com/DevExpress-Examples/How-to-create-a-custom-DiagramControl-toolbox

Expanded See Also

Is this topic helpful?​​​​​​​