Event in WPF Diagram (SfDiagram)

9 Jun 202110 minutes to read

An Event is a common BPMN process model element that represents something happens during a business process and its is notated with a circle.
The EventType property of the BPMNNodeViewModel allows you to set the type of event that occurred during the process. The default event type is None.
The type of events are as follows:

* Start: Occurs at the beginning of the process and every business process starts with an event.
* Intermediate: Occurs in the middle of the process.
* End: Occurs at the end of the process and every business process ends with an event.

The following code example explains how to create a BPMN event.

<!--Initialize the SfDiagram-->
<syncfusion:SfDiagram x:Name="diagram">
    <!--Initialize the Node-->
    <syncfusion:SfDiagram.Nodes>
        <!--Initialize the Node Collection-->
        <syncfusion:NodeCollection>
            <!--Initialize the BpmnNodeViewModel-->
            <syncfusion:BpmnNodeViewModel UnitHeight="70" UnitWidth="100" OffsetX="100" OffsetY="100" Type="Event" EventType="Start">
            </syncfusion:BpmnNodeViewModel>
        </syncfusion:NodeCollection>
    </syncfusion:SfDiagram.Nodes>
</syncfusion:SfDiagram>
//Initialize the diagram.
SfDiagram diagram = new SfDiagram();

//Initialize the BpmnNodeViewModel.
BpmnNodeViewModel node = new BpmnNodeViewModel()
{
  OffsetX = 100,
  OffsetY = 100,
  UnitHeight = 70,
  UnitWidth = 100,
  Type = BpmnShapeType.Event,
  EventType = EventType.Start,
};

// Add the node into the Node's collection.
(Diagram.Nodes as NodeCollection).Add(node);

WPF Diagram BPMN Event

BPMN event trigger

The event triggers are notated as icons inside the circle and they represent the specific details of the process. The EventTrigger property of the BpmnNodeViewModel allows you to set the type of trigger. By default, it is set to None. The following code example explains how to create a BPMN trigger.

<!--Initialize the SfDiagram-->
<syncfusion:SfDiagram x:Name="diagram">
    <!--Initialize the Node-->
    <syncfusion:SfDiagram.Nodes>
        <!--Initialize the Node Collection-->
        <syncfusion:NodeCollection>
            <!--Initialize the BpmnNodeViewModel-->
            <syncfusion:BpmnNodeViewModel UnitHeight="50" UnitWidth="50" OffsetX="100" OffsetY="100" Type="Event" EventType="Start" EventTrigger="Message">
            </syncfusion:BpmnNodeViewModel>
        </syncfusion:NodeCollection>
    </syncfusion:SfDiagram.Nodes>
</syncfusion:SfDiagram>
//Initialize the diagram.
SfDiagram diagram = new SfDiagram();

//Initialize the BpmnNodeViewModel.
BpmnNodeViewModel node = new BpmnNodeViewModel()
{
  OffsetX = 100,
  OffsetY = 100,
  UnitHeight = 50,
  UnitWidth = 50,
  Type = BpmnShapeType.Event,
  EventType = EventType.Start,
  EventTrigger = EventTrigger.Message
};

// Add the node into the Node's collection.
(Diagram.Nodes as NodeCollection).Add(node);

WPF Diagram BPMN Event and Trigger

The following table shows the type of event triggers.

Event / Trigger Start Non-Interrupting Start Intermediate Non-Interrupting Intermediate Throwing Intermediate End
None None Trigger Start event BPMN Shape None Trigger Interupting event BPMN Shape None Trigger Intermediate event  BPMN Shape None Trigger NonInteruptingIntermediate BPMNShape None Trigger Throwing Intermediate event BPMNShape None Trigger End event  event  BPMNShape
Message Message Trigger Start Event BPMN Shape Message Trigger NonInterupting Event BPMN Shape Message Trigger Intermediate Event BPMN Shape Message Trigger NonInteruptingIntermediate Event BPMN Shape Message Trigger ThrowingIntermediate Event BPMNShape Message Trigger End Event BPMN EndShape
Timer Timer Trigger Start Event BPMNShape Timer Trigger NonInterupting Event BPMN Shape Timer Trigger Intermediate Event BPMN Shape Timer Trigger NonInteruptingIntermediate  Event BPMN Shape Timer Trigger Throwing Intermediate  Event BPMN Shape Timer Trigger End Event BPMN Shape
Conditional Conditional Trigger Start BPMN Shape Conditional Trigger NonInterupting BPMN Shape Conditional Trigger Intermediate BPMN Shape Conditional Trigger NonInteruptingIntermediateBPMNShape Conditional Trigger ThrowingIntermediateBPMNShape Conditional Trigger EndBPMNShape
Link Link Trigger Start BPMN Shape Link Trigger NonInterupting BPMN Shape Link Trigger Intermediate Event BPMNShape Link Trigger NonInteruptingIntermediateBPMNShape Link Trigger ThrowingIntermediate  Event BPMN Shape Link Trigger EndBPMNShape
Signal Signal Trigger Start Event BPMN Shape Signal Trigger NonInterrupting Event BPMN Shape Signal Trigger Intermediate Event BPMN Shape Signal Trigger NonInterrupting Event BPMN Shape SignalThrowing Trigger Intermediate  Event BPMN Shape Signal Trigger End Event BPMN Shape
Error Error Trigger Start Event BPMN Shape Error Trigger NonInterrupting Event BPMN Shape Error Trigger Intermediate Event BPMN Shape Error Trigger NonInterrupting Event BPMN Shape Error Throwing Trigger Intermediate  Event BPMN Shape Error Trigger End Event BPMN Shape
Escalation Escalation Trigger Start Event BPMN Shape Escalation  Trigger  Non-Interrupting  Event BPMN Shape Escalation  Trigger  Intermediate  Event BPMN Shape Escalation  Trigger Non-Interrupting  Event BPMN Shape Escalation  Trigger  Throwing Intermediate Event  BPMN Shape Escalation  Trigger  End Event BPMN Shape
Termination Termination Trigger Start Event BPMN Shape Termination  Trigger  Non-Interrupting  Event BPMN Shape Termination  Trigger  Intermediate  Event BPMN Shape Termination  Trigger Non-Interrupting  Event BPMN Shape Termination  Trigger  Throwing Intermediate Event  BPMN Shape Termination Trigger End  Event BPMN Shape
Compensation Compensation  Trigger Start Event  BPMN Shape Compensation  Trigger  Non-Interrupting  Event BPMN Shape Compensation Trigger Intermediate  Event BPMN Shape Compensation  Trigger Non-Interrupting  Event BPMN Shape Compensation  Trigger  Throwing Intermediate Event  BPMN Shape Compensation  Trigger End BPMN  Event Shape
Cancel Cancel  Trigger Start Event  BPMN Shape Cancel  Trigger  Non-Interrupting  Event BPMN Shape Cancel Trigger Intermediate  Event BPMN Shape Cancel  Trigger Non-Interrupting  Event BPMN Shape Cancel  Trigger  Throwing Intermediate Event  BPMN Shape Cancel Trigger End  Event BPMN Shape
Multiple Multiple Trigger Start  Event BPMN Shape Multiple Trigger Non-Interrupting  Event BPMN Shape Multiple Trigger Intermediate BPMN Shape Multiple Trigger Non-Interrupting Event BPMN Shape Multiple Trigger  Throwing Intermediate  Event BPMN Shape Multiple Trigger End Event  BPMN Shape
Parallel Parallel Trigger Start  Event BPMN Shape Parallel Trigger Non-Interrupting Event  BPMN Shape Parallel Trigger Intermediate  Event BPMN Shape Parallel Trigger End Event  BPMN Shape Parallel Trigger  Throwing Intermediate  Event BPMN Shape Parallel Trigger End Event  BPMN Shape