0
votes

I wish to be able to drag uniformresourcelocators from a browser to a FlowDocument based Wiki. The Wiki is implemented in .Net 4.5.1 using WPF.

The DragEnter and DragOver events are firing but the Drop event is not. Instead, the uri is auto inserted into the document as text. I need the Drop event to fire so that I can insert a Hyperlink element into the document.

// My DragEnter and DragOver handlers return the following effects.

if (e.Data.GetDataPresent("UniformResourceLocatorW")) e.Effects = DragDropEffects.Link;

(I have also tried DragDropEffects.Copy and DragDropEffects.All).

1

1 Answers

0
votes

After browsing the source code for the WPF TextEditorBase it appears that the Drop event handler is only called after UIElement.OnDrag gets a chance first. This is why the link is copied as text.

By changing my program to use the PreviewDrop event, I get first chance to process the event and mark it as handled.