Unable to set drag and drop Effects to Copy

SyntaxEditor for WPF Forum

Posted 4 years ago by Xinen Lee
Version: 16.1.0631
Avatar

Hi Actipro

I need to set the drag drop e.Effects to Copy depending on the format that is being dropped onto the editor, such that it displays the Copy cursor with a + sign when dragging over the editor. I'm trying to set e.Effects to Copy in PreviewDragOver, however the NotifyDragOver in DragDropManager will always overwrite my e.Effects as it uses the e.AllowedEffects to determine whether a Move is allowed. e.AllowedEffects is determined by the drag source and is readonly.

If I put e.Handled to true in PreviewDragOver, I get the copy effect I want but it doesn't go into DragDropManager.NotifyDragOver to display the drop caret in the right position.

For the actual Move/Copy behavior, I am able to set it to Copy in PasteDragDrop by setting e.DragEventArgs.Effects, however the cursor is still the Move cursor.

If a source allows both move and copy, the drag target should have control over whether to move or copy the element. 

Comments (5)

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Xinen,

Would you like to see another PasteDragDrop event fired with a new PasteDragDropAction.DragOver option so that you could set e.Effects there?  Perhaps we initialize it beforehand with our logic.


Actipro Software Support

Posted 4 years ago by Xinen Lee
Avatar

That would be fine, as long as it is fired after setting e.Effects in NotifyDragOver for both dropAllowed and !dropAllowed.

[Modified 4 years ago]

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Xinen,

Why would you need it to fire when !dropAllowed?  In that scenario you already told us in NotifyDragEnter that you didn't want to allow a drop at all.


Actipro Software Support

Posted 4 years ago by Xinen Lee
Avatar

Hi, 

I don't really need !dropAllowed at this moment, just dropAllowed. I just thought it would be convenient to ask for both in case it is needed later.

Thanks!

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Xinen,

I don't think it would be needed if !dropAllowed, but we will update PasteDragDrop to fire on drag over as long as dropAllowed = true.  This update will be in the next maintenance release.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.