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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ItemAdded for DragDrop Not Firing

Thread ID:

Created:

Updated:

Platform:

Replies:

143913 Apr 10,2019 10:55 AM UTC Apr 15,2019 11:44 AM UTC WPF 5
loading
Tags: SfDiagram
Mike Cowing
Asked On April 10, 2019 10:55 AM UTC

I have mocked up a quick example based on various part projects I've seen on the forum, but I've merged it with the my data objects (simplified versions) I have in my main project. I have two problems, which I think are related.

1) When I add an item to the diagram through adding a new object into my collection: the object is added and appears on the diagram canvas, but can't be interacted with

2) When I drag from the stencil there is no trigger of the "ItemAdded" event I've seen in the examples

I've uploaded the example and your help would be appreciated.


Attachment: sfDiagramTest_26747ee8.7z

Ramya Thirugnanam [Syncfusion]
Replied On April 11, 2019 10:25 AM UTC

Hi Mike, 
 
Thanks for contacting Syncfusion support. 
 
We have modified the sample to resolve the reported issue. Please find the modified sample as below. 
 
 
 
Reported issue 
Response 
When I add an item to the diagram through adding a new object into my collection: the object is added and appears on the diagram canvas but can't be interacted with. 
We can reproduce the reported issue. The root cause of the reported issue is implementing the INotifyPropertyChanged for the UIControl class. It restricts the property changed notifications of  its base class “NodeViewModel” . So, the interaction with node is dis abled.  
 
 
Solution: 
Please remove the INotifyProperyChanged from the UIControl class. 
 
public class UIControl : NodeViewModel/*, INotifyPropertyChanged*/ 
 
 
Additional Information Required: 
Could you please confirm us whether your requirement is to implement custom property changed notification in UIControl? 
When I drag from the stencil there is no trigger of the "ItemAdded" event I've seen in the examples 
We can reproduce this reported issue. This is the sample side issue.  Please don’t use or set  NodeViewModel as content of the Symbol/NodeViewModel. Since, we are using serialization and deserialization approach for drag and drop the element from stencil. 
 
 
We can host the NodeViewModel as symbol instead of ISymbol to the stencil. Based on that , we have modified the sample.  
 
Sample Changes: 
We have created a custom class named as UIControlContent and assigned this as content of the NodeViewModel. 
 
Also, Content and ContentTemplate cannot be serialized while drag and drop. So, we have achieved this(content) by using custom property ContentName and initialized the ContentTemplate in the ItemAddedEvent. 
 
We have set UnitWidth and UnitHeight for UIControl in its constructor. 
 
Additional Information: 
 
We need to add DataContract and DataMember attributes for new serializable custom class and its properties.  
 
 
 
Regards, 
Ramya T 


Mike Cowing
Replied On April 12, 2019 12:57 AM UTC

Thank you for the quick response.

To confirm your UIControl question. I do need property changed notification, but I'm happy with the intermediate ViewModel class approach. I understand how that's working, so I'm ok with that. 

I've taken a look and whilst I can get the example to work, when I integrate this into my main code it fails to work. I suspect it's the same INotifyProperyChanged issue, but I can't track down how this is interfering. It appears to me as though the code for the class is correct, and as per the example. I've even created a simple version of my class, which is identical and still no dice.

What I'm experiencing is when I drag from the stencil, I don't see any preview, nor do I trigger the ItemAdded event. As I understand it the ItemAdded event will take a serialized copy of the stencil object. The ContentTemplate is essentially what's visualised as part of drag/drop and the display on the diagram. Incidentally if I add this code to the example "stencil.Constraints = StencilConstraints.ShowPreview | StencilConstraints.GroupExpanded;" this doesn't trigger the ItemAdded event either and is similar to the behaviour I see in my app. Is that related? and why would that code not work. It's using bitwise to configure the Constraints?

I'm happy to send you my main application if that'll help, but I don't want to post it publically. Is there any check I can do to see if INotifyProperyChanged is getting in the way?

Thanks, Mike...



Ramya Thirugnanam [Syncfusion]
Replied On April 12, 2019 12:32 PM UTC

Hi Mike, 
  
In order to work with your main application, a support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates .  
  
Regards,  
Ramya T  


Mike Cowing
Replied On April 12, 2019 09:23 PM UTC

I'll respond on the ticket too, but I've recreated the UserControl from scratch and I have it working correctly now. I am not sure why it's working, or rather why it wasn't as the code looks identical. 

Thanks for your help...

Karkuvel Rajan Shanmugavel [Syncfusion]
Replied On April 15, 2019 11:44 AM UTC

Hi Mike, 
 
Thanks for the update.  
 
Please let us know if you require further assistance on this. 
 
Regards, 
Karkuvel Rajan S 


CONFIRMATION

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

Live Chat Icon For mobile
Live Chat Icon