DiagramControl.ItemInitializing Event

Fires each time an item is created via the DevExpress.Diagram.Core.ItemTool.

Namespace: DevExpress.XtraDiagram

Assembly: DevExpress.XtraDiagram.v20.1.dll

Declaration

[DiagramCategory(DiagramCategory.DiagramItems)]
public event EventHandler<DiagramItemInitializingEventArgs> ItemInitializing
<DiagramCategory(DiagramCategory.DiagramItems)>
Public Event ItemInitializing As EventHandler(Of DiagramItemInitializingEventArgs)

Event Data

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

Property Description
Item Returns the diagram item that is being initialized.
ItemUsage Indicates whether the item is a part of the diagram or toolbox preview.

Remarks

The event parameter's DiagramItemInitializingEventArgs.ItemUsage property indicates whether the item has been created in the diagram or toolbox preview.

See the example below.


void Diagram_ItemInitializing(object sender, DiagramItemInitializingEventArgs e) {
            if ((e.Item is DiagramConnector) && (e.ItemUsage == DevExpress.Diagram.Core.ItemUsage.Diagram)) {
                (e.Item as DiagramConnector).Type = DevExpress.Diagram.Core.ConnectorType.Straight;
                e.Item.ThemeStyleId = (e.Item as DiagramConnector).BeginItem.ThemeStyleId;
                e.Item.StrokeId = (e.Item as DiagramConnector).BeginItem.ForegroundId;
                e.Item.Appearance.Options.UseBorderSize = true;
                e.Item.Appearance.BorderSize = 3;
            }
        }
See Also