A newer version of this page is available. Switch to the current version.

DiagramControl.ItemCreating Event

Occurs when the DiagramControl creates a diagram item.

Namespace: DevExpress.XtraDiagram

Assembly: DevExpress.XtraDiagram.v19.1.dll


public event EventHandler<DiagramItemCreatingEventArgs> ItemCreating

Event Data

The ItemCreating event's data class is DiagramItemCreatingEventArgs. The following properties provide information specific to this event:

Property Description
Item Gets or sets the item that is about to be created.
ItemType Gets the type of the item that is about to be created.
ItemUsage Indicates whether the item is a part of the diagram or toolbox preview.


You can use the ItemCreating event to create custom items. The following code snippet illustrates how to use the event to substitute regular shapes with custom DiagramShapeEx shapes.

private void DiagramControl1_ItemCreating(object sender, DevExpress.XtraDiagram.DiagramItemCreatingEventArgs e) {
    if (e.ItemType == typeof(DiagramShape)) {
        e.Item = new DiagramShapeEx();

Register custom item types at the application start using the DiagramItemTypeRegistrator.Register method to enable their deserialization.

See Also