I am having issues to do this. I have setup the following RadTreeView control:
In the Code Behind I have the following:
DragDropManager.AddDragInitializeHandler(trvModule, New DragInitializeEventHandler(AddressOf OnDragInitialize), True)
DragDropManager.AddDragOverHandler(trvModule, AddressOf OnDragOver, True)
DragDropManager.AddDragDropCompletedHandler(trvModule, New DragDropCompletedEventHandler(AddressOf OnDragDropCompleted), True)
DragDropManager.AddDropHandler(trvModule, New DragEventHandler(AddressOf OnDropElement), True)
I have seen this working in Windows Apps, but I am not being able to make it work in my WPF application.
I saw this might be to a security problem?
Can you please provide any help to solve the problem?
I cannot attach the project for security restrictions, but I can paste any piece of code you need.
Any help will be much appreciated.
7 Answers, 1 is accepted
I am afraid that without your implementation and environment I cannot tell why the drag operation doesn't work. However, I prepared a small example demonstrating drag/drop between files in the Windows Explorer and a WPF RadTreeView. Please give it a try and let me know if I am missing something.
Keep in mind that while you are dragging from an external application the default drag/drop behavior of RadTreeView and its visual appearance won't work. Also, the DragInitialize handler won't be fired since the drag starts in the external source.
Even though your solution works, the application type is a "Windows Application". I am not having problems with that.
I am having problems with WPF Application types.
I cannot attach the solution here for some reason, so please take a look at the screenshots.
I sent you a C# project so please excuse me for that. I create a new one on VB.NET with its application type set to WPF application and everything works as expected. Can you please check it out and let me know if it works on your side?
As a side note, you cannot attach the solution because the forum allows adding only image files. If you want to send us a .zip file with the project that demonstrates the issue you can open a new support ticket from your telerik.com account.
Hello Martin, I think I see the problem, but I am not sure what the root cause is.
Basically, I run your app and I was able to drag and drop fine. But when I run my app (which is MOSTLY the same), it won't work.
Looking for differences, I found that you have in the Debug folder a Manifest file setting some security permissions. After digging into that, I found that I am able to run the app and drag and drop files if I run the app from outside visual studio, but not from within.
So question is:
What security configuration is required in the proyect for drag and drop to work within visual studio?
Is this related to the manifest file as mentioned?
I haven't made any changes in the project's configuration. I just created a new VB.NET WPF Application from the "Add New Project" dialog. It seems that Vistual Studio is adding the .manifest file by default.
You can check if the drag operation works in a new VB.NET project. And, if you have any specific configuration on your project or Visual Studio itself. Also, you can try your project on a different machine.
After a long while I have finally figured this one out so I thought I would post the solution in case anyone else experiences similiar issues. I was launching Visual Studio in "Administrator" mode. since Windows Explorer launches by default in medium security by default and so visual studio would not allow dragging from a medium security to an elevated security mode. See this posting for a full explanation.
That's great. Thank you for sharing your solution. I believe that it is going to be helpful for someone else too.
Telerik by Progress