We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Stencil with Custom Nodes

Hello,

I am trying to follow the demo on adding stencils and combining it with custom nodes. I am not having much success. 
I can either get the custom node to show up in the stencil, but cannot add it to the diagram, or have it show up on the diagram, but not show up in the stencil.

Is there an example, or demo that I can view that has a custom node in the stencil that works also on the diagram?

Thanks,

3 Replies

KR Karkuvel Rajan Shanmugavel Syncfusion Team November 6, 2019 05:28 AM UTC

Hi Dave, 
 
Thanks for contacting Syncfusion support.  
 
Requirement : Need to use custom node in stencil and diagram. 
 
In SfDiagram we didn’t serialize Content, ContentTemplate, ShapeStyle while drag and drop from stencil. So we have to preserve the template and style in resources and assign them after adding node in diagram page. We have to create a custom property in custom node class and serialize it with the help of DataMember attribute and assign its value to content of the node.  
 
We have prepared a simple sample for your requirement. In the sample we have created a custom node class with custom property to retain the content of node and used a custom property to assign the content template in item added event. Please find the sample link below. 
 
 
Regards, 
Karkuvel Rajan S  



DD Dave Dake November 6, 2019 03:55 PM UTC

The sample that you provided was very clear. I now understand how to use it.

Thank you.


KR Karkuvel Rajan Shanmugavel Syncfusion Team November 7, 2019 04:21 AM UTC

Hi Dave, 
 
Thanks for the update. 
 
Please contact us if you need any further assistance. 
 
Regards, 
Karkuvel Rajan S  


Loader.
Live Chat Icon For mobile
Up arrow icon