Drag and Drop support required

SyntaxEditor for WPF Forum

Posted 4 years ago by Xinen Lee
Version: 16.1.0631
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Avatar

Hi Actipro,

I am implementing some drag and drop features and need some support.

 

1. Block selection support

When dragging a block selected text from Visual Studio, it uses a 'MSDEVColumnSelect' clipboard format. Currently Actipro does not support this format and the dropped block text will not be added as a block selection. Would it be possible for you to support this please?

 

2. Setting caret after drop

In some circumstances I would like to set the caret after a drop. I can't do this in the Drop event as the text replace has not occurred yet. I'm unable to find any suitable event to perform this caret set. Do you have any suggestions?

 

Thanks!

[Modified 4 years ago]

Comments (3)

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

Hi Xinen,

1) Great idea!  We've done some research and found a way to support both block and full line paste/drop compatibility with Visual Studio.  This will be in the next maintenance release.

2) A TextChanged event will be fired with this change type: TextChangeTypes.DragAndDrop.  You could handle that event and look for that change type and do your caret set there.


Actipro Software Support

Posted 4 years ago by Xinen Lee
Avatar

1) Thanks! Will you implement the 'MSDEVColumnSelect' clipboard format? Because we need it for dragging block text to/from other applications (other than VS) as well.

2) I did try setting the Caret in the DocumentTextChanged event but the Caret seems to be set again after that.

3) I have one more need: I need to know when there is a Drop on another application. The wpf Drop event only triggers when my application is the target drop app. There's no way to know whether my datasource has been dropped elsewhere. In DragDropManager, a CutCopyDragAction.Drag event is raised before DoDragDrop, but not after. Would it be possible for you to raise another event right after?

[Modified 4 years ago]

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

Hi Xinen,

1) Yes we support that clipboard format with the change, and also the other one used for the VS line copy.

2) Hmm, it does look like the selection is updated right after that DragAndDrop text change because the replacement is done with a view.ReplaceSelectedText() call.  You might have to do a Dispatcher.BeginInvoke in this scenario so that your caret change happens after all that completes.

3) You could watch TextChanged for this scenario.  If you see a change with TextChangeTypes.DragAndDrop that has no inserted text operation, you'd know it was dropped outside of the editor.


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.