Back to Devexpress

DiagramEditOperation.AddShape Property

aspnet-js-diagrameditoperation-dot-addshape.md

latest1.9 KB
Original Source

DiagramEditOperation.AddShape Property

Identifies the AddShape operation.

Declaration

ts
static readonly AddShape: string

Property Value

TypeDescription
string

Returns “AddShape”.

|

Remarks

The operation parameter returns the AddShape value if the RequestEditOperation event fired for the following reasons:

  • a user is about to add a shape,
  • the ASPxDiagram control is updating the Paste command state (for instance, before displaying a context menu).

Use the reason parameter to identify why the event fired.

aspx
<dx:ASPxDiagram ID="Diagram" runat="server" Width="100%" Height="600px">
    <ClientSideEvents RequestEditOperation="onRequestEditOperation" />
    ...
javascript
function onRequestEditOperation(s, e) {
    if(e.operation === DiagramEditOperation.AddShape) {
        if(e.args.shape.type !== "employee" && e.args.shape.type !== "team") {
            if(e.reason !== DiagramRequestEditOperationReason.CheckUIElementAvailability)
                showWarning("You can add only a 'Team' or 'Employee' shape.");
            e.allowed = false;
        }
    }
    ...
}

The RequestEditOperation event does not fire for the AddShape operation if the AllowAddShape property is set to false.

See Also

DiagramEditOperation Class

DiagramEditOperation Members