Swimlane-Stencil in WPF Diagram (SfDiagram)

5 May 20212 minutes to read

Diagram provides support to add lanes and phases to Stencil.

Add lanes and phases into stencil

Diagram elements such as Lane, and Phase can be used to visualize the Symbol.

The following code sample shows how to add the lanes and phases to palette.

<syncfusion:Stencil x:Name="stencil"                             BorderThickness="0,0,1,0" ExpandMode="All">
     <syncfusion:Stencil.SymbolSource>
         <syncfusion:SymbolCollection>
        <!--Rendered HorizontalSwimlane-->
         <syncfusion:LaneViewModel ID="HorizontalSwimlane" Key="Swimlane Shapes" Orientation="Horizontal" ></syncfusion:LaneViewModel>
         <!--Rendered VerticalSwimlane-->
        <syncfusion:LaneViewModel ID="VerticalSwimlane" Key="Swimlane Shapes" Orientation="Vertical" ></syncfusion:LaneViewModel>
         <!--Rendered HorizontalPhase-->
        <syncfusion:PhaseViewModel ID="HorizontalPhase" Key="Swimlane Shapes" Orientation="Horizontal" ></syncfusion:PhaseViewModel>
        <!--Rendered VerticalPhase-->
        <syncfusion:PhaseViewModel ID="VerticalPhase" Key="Swimlane Shapes" Orientation="Vertical"></syncfusion:PhaseViewModel>
                        </syncfusion:SymbolCollection>
                    </syncfusion:Stencil.SymbolSource>
         <syncfusion:Stencil.SymbolGroups>
             <syncfusion:SymbolGroups>
               <!--Separate groups based on the key-->
             <syncfusion:SymbolGroupProvider MappingName="Key"/>
         </syncfusion:SymbolGroups>
    </syncfusion:Stencil.SymbolGroups>
 </syncfusion:Stencil>

Swimlane SymbolPalette Shapes

Add Swimlane shapes to palette using the category

You can add the swimlane shapes using the category. For more information, refer to the Symbol categories.

Interactions

  • The drag and drop support for swimlane shapes have been provided.
  • When you drag and drop the lane shape, if the diagram already contains swimlane with the same orientation, the lane will be added and stacked inside a swimlane based on the order. Otherwise, it will be added a new swimlane.
  • The phase will only drop on the swimlane shape with the same orientation.
    The following image shows how to drag symbol from palette.

Drag Symbol from Palette