1

In my WPF application, I have a RichTextBox. I can add a simple control such as TextBlock using this code:

TextPointer tp = myRichTextBox.CaretPosition.GetInsertionPosition(LogicalDirection.Forward);
InlineUIContainer myInlineUIContainer = new InlineUIContainer(myTextBlock, tp);

My problem comes when I try to move the same control around the RichTextBox. It just simply disappears leaving only a space char. I have the AllowDrop and IsDocumentEnabled properties set to true. I've searched all over the web and couldn't find a clear explanation as to why this happens. Could anyone explain and help me to solve this issue??

Thanks

David
  • 261
  • 1
  • 17
  • I was able to reproduce the same problem. I even tried adding `Drop`/`PreviewDrop` event handlers to the `InlineUIContainer`/`TextBlock` to see if I could catch them and provide a workaround but to no avail. Not sure what I'm doing wrong. Found this as well, seems to be the same problem: http://www.codeproject.com/Questions/318192/Csharp-TextBlock-drap-and-drop-operation-in-WPF-Ri This one seems to be dealing with dragging things into the `RichTextBox`: http://stackoverflow.com/questions/4418493/c-drag-and-drop-in-wpf-richtextbox – ToastyMallows Jul 05 '13 at 20:32

0 Answers0