How to make Actipro SyntaxEditor bubble DragDrop event to parent when dragging files into it?

SyntaxEditor for WPF Forum

The latest build of this product (v25.1.1) was released 18 days ago, which was before this thread was created.
Posted 6 days ago by Jiang - appeon
Version: 24.1.1
Avatar

I’m using the WPF Actipro SyntaxEditor.
By default, the control handles drag-and-drop internally (via OnPasteDragDrop) and marks the Drop event as handled, so the event never reaches parent controls like a Grid.

I need a way to detect when the drag operation contains files (DataFormats.FileDrop) and in that specific case, allow the Drop event to bubble up so the parent container can handle it.

Example scenario:

<Grid Drop="Grid_Drop"> <actipro:SyntaxEditor AllowDrop="True" /> </Grid>

I want the parent Grid to handle the drop instead, but only when the drag contains files.

Question:
What’s the recommended way to let a Drop event bubble up from SyntaxEditor to its parent when the dragged data is a file?

  • Is there a way to prevent SyntaxEditor from consuming the drop?

  • Or can I forward the drop to the parent without causing recursion in OnPasteDragDrop?

[Modified 6 days ago]

Comments (1)

Posted 5 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

When SyntaxEditor.AllowDrop is true, the drop event is being handled on the editor view, so there isn't really a top-level method you can override to affect default behavior here.

You could handle the SyntaxEditor.PasteDragDrop event and look for e.Action kinds of { DragEnter, DragOver, and DragDrop }.  When those are detected and e.DataStore.GetDataPresent(DataFormats.FileDrop), you could set e.Text = null to prevent SyntaxEditor's default behavior.  Then maybe try to set e.DragEventArgs.Handled = false to see if the event bubbles up.  Or if that doesn't work, raise an event of your own or call a method to let your parent handle the drop.


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.