ScatterViewItem Drag and Drop into RichTextBox

354 views Asked by At

I have a ScatterView which consist of 2 items: an Image and a RichTextBox. RichTextBox has AllowDrop set to true.

When I drag the Image to the RichTextBox, the image disappears completely but RichTextBox's DragEnter and Drop event did not fire at all. Neither did PreviewDragEnter nor PreviewDrop.

I tried setting RichTextBox's AllowDrop to false, and the Image landed on top of the RichTextBox as expected.

How do I get the DragEnter and Drop event of RichTextBox to fire? The only thing that fires is the ScatterView's Drop event.

1

There are 1 answers

1
Robert Levy On BEST ANSWER

Drag & drop with Surface controls (like ScatterView) is different from normal Windows drag & drop. The thing being dragged is a 2d shape (not a single point) which could have multiple inputs dragging it around. Because of this, we couldn't shim the Surface drag drop functionality into the existing WPF drag drop APIs. Instead, you'll need to use attached events from the SurfaceDragDrop object like http://msdn.microsoft.com/en-us/library/microsoft.surface.presentation.surfacedragdrop.dragenter.aspx which are very similar to the WPF equivalents but enable Surface-friendly user experiences.