C#: Drag and Drop in WPF (Richtextbox)

不想你离开。 提交于 2019-12-06 05:07:41
Tom

I was curious as to why so I had a little play and eventually got it to work. Essentially, I started by binding to the PreviewXXX events like so:

AllowDrop="True" PreviewDragEnter="RichTextBox_DragEnter" PreviewDragOver="RichTextBox_DragEnter" PreviewDrop="RichTextBox_Drop"

Even still, they STILL didn't work. But the answer came here, in the form of elevated permissions. I usually run VS2010 with admin elevation. Because I was dropping some files from Explorer onto my RichTextBox, it was essentially banning the operation because Explorer runs in a non-elevated user mode. Running the VS2010 in a non-elevated mode fixed the problem. The article linked does suggest some workarounds, but I haven't tried them yet.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!