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

[Bug] ISymbol overwrites Content and ContentTemplate in NodeViewModel after ItemAdded event

Thread ID:





120639 Sep 29,2015 06:25 PM UTC Sep 30,2015 12:28 PM UTC WPF 1
Tags: SfDiagram
Steven Brodhead
Asked On September 29, 2015 06:25 PM UTC

If you set Content and ContentTemplate on a NodeViewModel in the ItemAdded event handler after a symbol item is dragged in from the stencil, the values in the associated ISymbol overwrite Content and ContentTemplate some time after the event handler is called. These should probably be initialized from the ISymbol object's data BEFORE the event is fired.
A workaround is to have an isInitialized flag and set the content and template on the subsequent ItemTapped event, which is called when the user released the mouse button, but this is probably not the intended procedure.

Ranjitha Amirthalingam [Syncfusion]
Replied On September 30, 2015 12:28 PM UTC

Hi Steven,

Thanks for contacting Syncfusion Support.

We have achieved your requirement “Need to set ContentTemplate to the dropped Node”. SymbolTemplate of ISymbol is applied to ContentTemplate of the droppedNode once droppedNode is added into the Page (ItemAdded event completed). So, SymbolTemplate will be overrided if we set ContentTemplate to the droppedNode in the ItemAdded event. So, ContentTemplate to droppedNode is set after SymbolTemplate is applied. We have provided sample and code example to represent this. Please refer to the sample and code example as below .

Code example:

void MainWindow_ItemAdded(object sender, ItemAddedEventArgs args)


            if (args.ItemSource == ItemSource.Stencil)


                var dropedItem = args.Item as INode;

                if (dropedItem != null)


                    dropedItem.PropertyChanged += dropedItem_PropertyChanged;




        void dropedItem_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)


            if (e.PropertyName.Equals("ContentTemplate"))


                (sender as INode).PropertyChanged -= dropedItem_PropertyChanged;

                (sender as INode).ContentTemplate = this.Resources["nodetemplate"] as DataTemplate;



       <DataTemplate x:Key="nodetemplate">


                <Button Content="mycontent" Width="80" Height="50"/>


Sample Link: DropNodeCntntTmplte

Ranjitha A.


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