DataSource and Swimlanes

Hello!

I find samples, whang collection binds to DataSource and build Tree.

But i want to display objects in swinlanes, so i need to store and bind X, Y and so on.

Also a need to store swimlane.


I tried solve this with DataTemplate for Node + NodeCollection, but there is not DataContext on DataTemplate.


So i need solution to draw custom Node for Smilane and bind to custom props...



8 Replies 1 reply marked as answer

KR Karkuvel Rajan Shanmugavel Syncfusion Team September 7, 2021 11:46 AM UTC

Hi Customer, 
 
Thanks for using Syncfusion Products. 
 
Requirement: Save and Load Swimlane. 
 
We have analyzed your requirement and prepared a simple sample for that. In the sample we have used our default diagram elements to serialize and deserialize. Please find the sample in below link. 
 
 
If we misunderstood your requirement please elaborate your requirement with more details. That will help us to provide proper solution to your requirement.  
 
Regards, 
Karkuvel Rajan S 



AN Anton September 7, 2021 12:36 PM UTC

Hello, thank you for reply!

I want to use business object, not NodeViewModel. And save, load diagramm content via serialization of my business class. For example - on the left side i have treeview, on the right side diagram with SWMLANES. And when i change my business object (FE name, color) it is changing in diagramm and vise versa.


And when i load my business class diagram restored by its content....



KR Karkuvel Rajan Shanmugavel Syncfusion Team September 8, 2021 06:37 AM UTC

Hi Anton, 
 
Requirement: Need to create swimlane with business object. 
 
We have created custom sample task for your requirement and we will provide you the solution on 9th September, 2021. In that sample, we are going to achieve your requirement in the following ways. 
 
Use custom serialization for save and load the business object. 
 
Create a method for get and set the values of the Height, Width, LaneOffsetX, and LaneOffsetY for the Diagram objects. 
 
We appreciate your patience until then. 
 
Regards, 
Karkuvel Rajan S 



KR Karkuvel Rajan Shanmugavel Syncfusion Team September 9, 2021 09:39 AM UTC

Hi Anton, 
 
Requirement: Need to create swimlane with business object.  
 
We have created a custom sample to achieve your requirement. In the sample we have used custom serializers to serialize and deserialize the business objects and with them we have prepared the swimlane. Please find the sample in below link. 
 
 
Regards, 
Karkuvel Rajan S 



AN Anton September 9, 2021 05:41 PM UTC

Thank you for your reply!


It's very hard to handle this, but possible.


I need to dysplay custom noe, but i see, that this display nothing ((( DataContext is null...


<!--Style for Node-->

            <Style TargetType="syncfusion:Node">

                <Setter Property="ContentTemplate">

                    <Setter.Value>

                        <DataTemplate>

                            <TextBlock Text="{Binding}"/>

                        </DataTemplate>

                    </Setter.Value>

                </Setter>

            </Style>





KR Karkuvel Rajan Shanmugavel Syncfusion Team September 10, 2021 06:43 AM UTC

Hi Rodrigue, 
 
Reported Issue: DataContext is null in the ContentTemplate of the node. 
 
We have analyzed the reported issue with the provided code example. In Default, the Content property of the NodeViewModel class or Custom NodeViewModel class acts as the DataContext for the ContentTemplate. So, we suspect that you have not set any value for the Content property of the custom node. Please set the value for the content property of the custom node class to resolve this issue. We have provided a simple sample to show that the reported issue does not occur when we set the value for the Content property of the custom class. Please find the sample link below. 
 
 
If the issue persists, please revert us with more details. 
 
Regards, 
Karkuvel Rajan S  



AN Anton September 10, 2021 07:25 AM UTC

Thanks!


Exactly, that i need.


NodeVM node = new NodeVM()

            {

                OffsetX = 200,

                OffsetY = 200,

                UnitHeight = 100,

                UnitWidth = 100,

                //Content = this,

            };

            node.Content = node;


Marked as answer

KR Karkuvel Rajan Shanmugavel Syncfusion Team September 10, 2021 11:17 AM UTC

HI Rodrigue, 
 
Most welcome. Please contact us if you need any further assistance. 
 
Regards, 
Karkuvel Rajan S 


Loader.
Up arrow icon