To give the ability to display and edit Richtext (Xaml) inside a treeview item,I have used a bindable Richtextbox (custom user control that used a richtextbox) to the HierachicalDataTemplate that used to populate the TreeViewItems.
This works fine but at the same time I want to have the drag and grop functionality in the treeview. My problem is when I click on the richtextbox (inside the treeviewitem) and do a drag it will do the richtextbox content dragging. What I want is to drag the treeviewitem insted (fire the drag and drop events of the treeviewitem).
NOTE: If I used a textblock this can be done but can’t display richtext. Any Help?
Trigger your drag from the on the “Preview” mouse events rather than the regular ones, and set the Handled flag in PreviewMouseMove when doing a drag so the RichTextBox never sees the MouseMove.
For example, you might record the mouse down location in PreviewMouseLeftButtonDown, then if you receive a PreviewMouseMove with the left button still down you can set e.Handled=true and then call DoDragDrop in a dispatcher callback.
The reason this works is that RichTextBox uses the regular (non-preview) mouse events.