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);
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);
The following table shows the type of event triggers.
Event / Trigger | Start | Non-Interrupting Start | Intermediate | Non-Interrupting Intermediate | Throwing Intermediate | End |
---|---|---|---|---|---|---|
None | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Message | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Timer | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Conditional | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Link | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Signal | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Error | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Escalation | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Termination | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Compensation | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Cancel | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Multiple | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Parallel | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |