windowsforms-devexpress-dot-xtradiagram-dot-diagramcontrol-cf9603a6.md
Fires each time a new item is added to the diagram by the end-user (e.g., dropped from the toolbox, drawn using a tool).
Namespace : DevExpress.XtraDiagram
Assembly : DevExpress.XtraDiagram.v25.2.dll
NuGet Package : DevExpress.Win.Diagram
[DiagramCategory(DiagramCategory.DiagramItems)]
public event EventHandler<DiagramAddingNewItemEventArgs> AddingNewItem
<DiagramCategory(DiagramCategory.DiagramItems)>
Public Event AddingNewItem As EventHandler(Of DiagramAddingNewItemEventArgs)
The AddingNewItem event's data class is DevExpress.XtraDiagram.DiagramAddingNewItemEventArgs.
Set the event parameter’s DiagramAddingNewItemEventArgs.Cancel property to true to prevent adding an item to the diagram.
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AddingNewItem event.
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.
winforms-diagram-track-and-restrict-drag-actions/CS/WinApp7/Form1.cs#L15
diagramControl1.AddingNewItem += DiagramControl1_AddingNewItem;
diagramControl1.BeforeItemsMoving += DiagramControl1_BeforeItemsMoving;
See Also