Prompt the user before deleting a shape in the diagram

Applies to: Nevron Diagram for .NET

How to prompt the user before deleting a shape in the diagram, and if needed cancel the delete operation?

You can subscribe for the NodeRemoving event of the document event sink service:

[C#]
private void OnNodeRemoving(NChildNodeEventArgs args)
{
    if (args.Child is NShape)
    {
        // prompt the user to confirm the delete if the delete is not allowed cancel the operation like this
        args.Cancel = true;
    }
}

[VB.NET]
Private Sub OnNodeRemoving(args As NChildNodeEventArgs)
    If TypeOf args.Child Is NShape Then
        ' prompt the user to confirm the delete if the delete is not allowed cancel the operation like this
        args.Cancel = True
    End If
End Sub

Article ID: 28, Created On: 10/5/2010, Modified: 11/15/2010