Click here to Skip to main content
15,904,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please help with the following: In my WinForm, I have a WPF RichTextBox in which Paragraph (only one Paragraph block is used) may contain one or several TextBlock's. When I try to drag-n-drop any TextBlock to a different location within the same RichTextBox, it disappears at the source location but is not inserted at the target location. Instead just a space is inserted. I have no idea where to search. Most topics are dedicated to drap-n-drop operations between different controls, not within the same one.

<UserControl x:Class="TetranTranslationStudio.MyRichTextBox"
    xmlns:x="" Height="162.711" Width="559.944" AllowDrop="False">
    <RichTextBox x:Name ="TargetBox" AcceptsReturn="False" SpellCheck.IsEnabled="True" Height="Auto" Width="Auto" VerticalScrollBarVisibility="Auto" IsDocumentEnabled="True" FontSize="14" FontFamily="Arial" AllowDrop="True">
        <FlowDocument xmlns="" ColumnWidth="400" FontSize="14" FontFamily="Arial" AllowDrop="True">
                        <Paragraph>This is a sample string which contains
                    <TextBlock>TextBlocks</TextBlock> that disappear when drags to a different location within the control

I will very much appreciate any help.

Updated 22-Jan-12 5:47am

1 solution

Have a look at Embed Custom GUIs in WPF[^]

The article shows how to handle drag-and-drop, cut-and-paste, deserialization, and printing.

Best regards
Espen Harlinn
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900