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

Drag/Drop Symbol

Thread ID:





41027 Feb 20,2006 07:51 PM UTC Jul 4,2006 07:19 AM UTC WinForms 3
Tags: Diagram
Chris C
Asked On February 20, 2006 07:51 PM UTC

We have an application similar to the DiagramBuilder example. There are cases where we want to cancel a drag/drop of a symbol node. I override the OnChildrenChanging event and set the EventArgs.Cancel property to true if we don''t want to insert the symbol. This seems to work in that the symbol is not added to the Model.Nodes list and the OnChildrenChangeComplete event is not fired. However, the selection outline is still visible on the diagram and the properties for the symbol are still visible in the PropertyEditor. I have to click elsewhere to get everything to refresh. I''ve tried adding Model.UpdateViews but that didn''t help. I already had a derived View class and an override for DrawSelectOutline so I added the following code to that routine: // Is the node in the SelectionList but not in the Model.Nodes list? if (Model.Nodes.Contains(node) == false) { if (this.SelectionList.Contains(node)) { this.SelectionList.Remove(node); } return false; } That removed the selection outline but the properties are still in the PropertyEditor. Any help with this would be greatly appreciated. Chris C

Administrator [Syncfusion]
Replied On February 23, 2006 02:57 PM UTC

Hi Chris, The Diagram.DragEnter event which gets Called when the mouse enters the diagram during a drag operation will let you restrict the symbol from being inserted into diagram. Please refer the following small code snippet. private void diagram1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) { // Check whether the data is of DragDropData which encapsulates the data needed to drag and drop a collection of nodes. if(e.Data.GetDataPresent(typeof(DragDropData))) { e.Effect = DragDropEffects.None; // Cancel all the drag drop effects. } } Also referring to the Diagram.Windows/Samples/QuickStart/DragDrop sample will give you an idea about how to implement the drag and drop support in EssentialDiagram. Please let me know if you have any queries. Thanks for your support to Syncfusion. Regards, Meera.

Chris C
Replied On February 23, 2006 06:59 PM UTC

That doesn''t quite solve my entire problem. First of all, the symbol must be created before I can determine whether or not it is a valid symbol to insert. As a result, I could not use OnDragEnter to do the check. However, I was able to use OnDragDrop to do the necessary checks. We also have particular cases where there can be only one instance of a particular symbol inserted in the diagram. The OnDragDrop method works when I attempt to drag/drop a symbol for the second time. However, it does not help if the user does a copy/paste of a symbol. It seems to me that OnChildrenChanging is the correct place to do this type of check and cancel the event. We do a similar thing with OnConnectionsChanging and links and it works fine. As I said earlier, using OnChildrenChanging seems to work except for a problem with the selection and properties. Is this a Syncfusion bug, or am I missing something?

Administrator [Syncfusion]
Replied On July 4, 2006 07:19 AM UTC

Hi Chris, As per the update on # 24212, the problem with NodeCollectionEvtArgs.Cancel property has been fixed and the next release of the Essential Diagram will include the fix. Thank you for your patience. Regards, Meera.


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

or the page will be automatically redirected to 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