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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Dropping Custom Node to SfDiagram from Stencil

Thread ID:





127293 Nov 8,2016 11:22 AM UTC Jan 31,2017 10:20 AM UTC WPF 3
Tags: SfDiagram
Asked On November 8, 2016 11:22 AM UTC

Good day!
I try to use SfDiagram at Essential Studio for WPF v. I want to combine two of your samples: "Stencil" and "Node Content".
I need put custom nodes( like "Node Content") from Stancil. I had some difficulty with that.
i can programmatically create and put Node object, but I cant do it correctly with NodeViewModel object. 
If you have any tips, please let me know.

I attached my project as example.


Attachment: Editor_cc09cfd7.7z

Keerthivasan Ramamoorthy [Syncfusion]
Replied On November 9, 2016 01:09 PM UTC

Hi Dmytro, 
We have deprecated the default View to ViewModel binding for Node and Connector. So, The properties of NodeViewModel and ConnectorViewModel will be bind to Node and Connector once Style is created in application(For Node and connector) with Default style key from BindingStyle.Xaml. We have to set BindingStyle while using ViewModel. We have modified the provided sample with these changes. 
Please refer to the modified sample from the below link. 
Sample link:Editor_Modified
Keerthivasan R. 

Replied On January 30, 2017 10:21 AM UTC

Hi again!
This video was made from your code example from this topic.
could you help me to find the reason why my elements have this behavior.

Attachment: Video_20170112_113813_65fce241.7z

Suresh Shanmugam [Syncfusion]
Replied On January 31, 2017 10:20 AM UTC

Hi Dmytro, 
Reported Issue: Issue with duplicate the Node with UIElement (Button) 
We have used DataContarctSerilaizer to do clipboard action in SfDiagram. We did not serialize the framework properties like Content and ContentTemplate properties. But the reported issue can be resolved in sample by using  ItemAdded Event of SfDiagram. 
Please refer the below code snippet how to set the Content and ContentTemplate in ItemAdded Event. 

//ItemAdded Event 
private void MainWindow_ItemAdded(object sender, ItemAddedEventArgs args) 
       if (args.ItemSource == ItemSource.ClipBoard) 
              CustomNodeViewModel cnvm = args.Item as CustomNodeViewModel; 
              cnvm.Content = new uButton() { Content = "SomeTEXT", Width = 50, Height = 50, IsEditable = false, ToolTip = "blah-blah-blah-blah" }; 
              cnvm.ContentTemplate = new DataTemplate { VisualTree = new FrameworkElementFactory(typeof(uButtonTemplete)) }; 

Suresh Shanmugam 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon