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
close icon

how to inherit Sf Diagram in Diagram Builder

Hi,

      The sample code provided in documentation for adding nodes from code is as follows:

NodeViewModel node = new NodeViewModel()

{

// Unique Guid for NodeViewModel

ID=Guid.NewGuid()              

};

nodes.Add(node);

diagramcontrol.Nodes = nodes;

How do I add nodes through code in the diagram builder sample for below source code?

http://www.syncfusion.com/downloads/support/forum/116072/DiagramBuilder_modified_e8901a9c.zip



2 Replies

MA madhu replied to Alaguraja Pandian May 7, 2014 11:05 AM UTC

Hi,

      The sample code provided in documentation for adding nodes from code is as follows:

NodeViewModel node = new NodeViewModel()

{

// Unique Guid for NodeViewModel

ID=Guid.NewGuid()              

};

nodes.Add(node);

diagramcontrol.Nodes = nodes;

How do I add nodes through code in the diagram builder sample for below source code?

http://www.syncfusion.com/downloads/support/forum/116072/DiagramBuilder_modified_e8901a9c.zip



Adding points to the above post

In StencilView.xaml there is a data template called "SansStar".

How to programmatically add node "SansStar" using code in the Diagram Control as mention in the link (http://help.syncfusion.com/UG/winrt/Documents/nodes.htm)?

http://www.syncfusion.com/downloads/support/forum/116072/DiagramBuilder_modified_e8901a9c.zip



PA Parthiban A Syncfusion Team May 7, 2014 04:39 PM UTC

Hi Madhu,

As you requested we have modified the sample. We can add nodes, groups and connections to DiagramVM.Nodes, DiagramVM.Groups and DiagramVM.Connectiosn respectively. We have added two nodes to DiagramVM.Nodes collections in DiagramVM constructor. And also we have added one resource dictionary named NodeTemplates, in which we have added node styles and templates, which in turn applied to nodes. For more information kindly refer the modified sample from attachment.

As Madhu requested we have added one node with SansStar data template applied, by adding those templates in NodeTemplates resource dictionary.

As Alaguraja requested, we have shown how to add nodes in code behind. Kindly refer the DiagramVM constructor from DiagramVM.cs file

Regards,

Parthiban


Attachment: DiagramBuilder_1162136a_85559d76.zip

Loader.
Live Chat Icon For mobile
Up arrow icon