Implement lazy drag and drop

I am trying to perform a lazy drag and drop operation. I want to show a list of files to my user, when the user drags the file and transfers it to the folder, the contents must be downloaded and delivered.

I am using the IDataObject interface, but my problem is that the GetData () method is being requested too early. For example, dragging and dropping around the desktop (without any change) will request the GetData () method a couple of times. And each of these calls starts downloading the file: /

Now, my question is: what is wrong here - why is the GetData () method called without any changes? Is there any other way to implement lazy drag and drop operations in .net?

+7
c # lazy-evaluation drag-and-drop
source share
2 answers

Maybe this might work for you ...

In each case, GetData () do the following:

  • you will need some kind of timer.
  • if your timer is already active, kill it.
  • create and start a new timer. Make it 1sec or determine its duration in the experiment.
  • by timer event do what needs to be done.

I use a similar procedure in many cases when such a workaround is required.

+1
source share

I think GetData is called so that the (potential) drop target can determine if it can accept the (potential) delete item (s). Have you considered using shell extensions?

+1
source share

All Articles