简体   繁体   中英

WPF UserControl Drag and Drop

I'm developing an extension for MS Visual Studio using WPF and I want to perform the drag and drop operation. Now, I did it in a small WPF app to see if it is working and succeed, however when I did it in my extension, I cannot perform the action. Looks like the drop operation is not allowed. When I tried GradOver/ DragEnter - everything works, however it is not good because those functions make many copies of what I would like to drag. What could be a problem in your opinion?

PS All Visual Studio extensions WPF controls inherent UserControl and not from Window as a regular WPF app.

Here is some of the code examples:

Drag Operation:

<Grid MouseLeftButtonDown="box1_MouseLeftButtonDown"/>

Drop Operation:

<Grid AllowDrop="True" Drop="box2_Drop"/>

Thanks!

我的问题的答案是在这篇文章中,非常简短且很有帮助: 不允许在VS2010扩展中的WPF ToolWindow中拖放答案此答案适用于MSVS2010,但在2015年也适用

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