Gateway in WPF Diagram (SfDiagram)

14 Dec 20233 minutes to read

Gateway is used to control the flow of a process and it is represented as a diamond shape. To create a gateway shape, the Type property of the BpmnNodeViewModel should be set to Gateway and the GatewayType property can be set to any of the appropriate GatewayType. The default GatewayType will be None. The following code example explains how to create a BPMN Gateway.

<!--Initialize the SfDiagram-->
<syncfusion:SfDiagram x:Name="diagram">
    <!--Initialize the Node-->
        <!--Initialize the Node Collection-->
            <!--Initialize the BpmnNodeViewModel-->
            <syncfusion:BpmnNodeViewModel UnitHeight="70" UnitWidth="100" OffsetX="100" OffsetY="100" Type="Gateway" GatewayType="None"> 
//Initialize the diagram.
SfDiagram diagram = new SfDiagram();

//Initialize the BpmnNodeViewModel.
BpmnNodeViewModel node = new BpmnNodeViewModel()
  OffsetX = 100,
  OffsetY = 100,
  UnitHeight = 70,
  UnitWidth = 100,
  Type = BpmnShapeType.Gateway,
  GatewayType = GatewayType.None

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

Create Gateway

The following table shows the different types of gateways:

GatewayType Symbol Description
None GateWay BPMN Shape It is represented as a diamond shape. None of the symbol shows inside this shape
Exclusive Exclusive GateWay BPMN Shape It is a state of the business process and based on the condition, breaks the flow into one or more mutually exclusive paths
Parallel Parallel GateWay BPMN Shape The Parallel gateways are used to represent two concurrent tasks in a business flow
Inclusive Inclusive GateWay BPMN Shape Breaks the process flow into one or more flows
Complex Complex GateWay BPMN Shape These gateways are only used for the most complex flows in a business process
EventBased EventBased GateWay BPMNShape The event-based Gateway allows you to make a decision based on events
ExclusiveEventBased Exclusive EventBased GateWay BPMN Shape Starts a new process instance with each occurrence of a subsequent event
ParallelEventBased Parallel EventBased GateWay BPMN Shape This gateway is similar to a parallel gateway. It allows for multiple processes to happen at the same time but unlike the parallel gateway, the processes are event-dependent