I added a NodeViewModel with an image to the SFDiagram stencil, but the image does not appear when dragged to the Diagram.

Hello, I successfully added an image to the symbolcollection using sfDiagram and stencil. However, when I drag the symbol to the diagram, a node is added without the image, although it has all the other properties of the symbol.

이미지_9834_1698210164539 before drag


Image_1672_1698210195468 after drag


I've attached the project file. What did I do wrong?


Attachment: SyncfusionStencilTest_4b01fccb.zip



1 Reply

DT Deepa Thiruppathy Syncfusion Team November 8, 2023 05:34 AM UTC

Hi SungGon Park,


Requirement: How to serialize Content and ContentTemplate of the node from stencil dragging


In SfDiagram, you cannot serialize the Content and ContentTemplate of every diagramming object. If you want to preserve the ContentTemplate of diagramming objects, keep them in resources and apply them once the diagramming objects are added to the Diagram page.


We have modified the provided sample and attached its modified version for your reference. In that sample, we added a custom class for NodeViewModel and a custom property to store the Content key value. Once a node is added to the diagram from the stencil, the content is added to the node using that ContentKey property.


Regards,

Deepa Thiruppathy


Attachment: SyncfusionStencilTest_modified_7cf315e1.zip

Loader.
Up arrow icon