简体   繁体   中英

RichTextBox throws exception when dragging and dropping inside it

I have a RichTextBox and when I try to drag & drop inside it it throws exception:

在此处输入图片说明

it happens when I'm in debug mode and the common language runtime exception flag is on.

This is my XAML -

<Grid>
    <RichTextBox x:Name="rtb"
                 ScrollViewer.VerticalScrollBarVisibility="Auto"
                 IsReadOnly="True" />
</Grid>

this is code behind -

public MainWindow()
{
  InitializeComponent();
  rtb.AppendText("aaaaaaa aaaaaaaaaaa aaaaaaaa aaaaaaaabbb bbbbb bbbbb bbbb");
}

Have you set AllowDrop = true ?
If you haven't, you can get bizarre errors

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM