Desktop Drag and Drop Files
With Silverlight 4 is the new Drop event which is present on all elements derived from UIElement. With this simple example we will display a Grey area which you can drop a file onto.
As you can see in the LayoutRoot_Drop event handler we are provided with a data object passed in via the event args object. When dropping files onto your Silverlight application this will be an array of FileInfo objects.
The FileInfo object contains basic file information such as its name and extension and size. To be able to read the file you will need to be running your application Out of Browser.
Neesha wrote:
I'm unable to drag and drop file.I'm using vs2012.
MarkSilver wrote:
Hi,
I like this drag and drop with files..the only thing is that i can`t get it work on my machine
I've just made a simple silverlight application copy and paste your code, and run it...it runs ok but when i drag and drop a file nothing happens...is this because of a setting in ie9 ? or in vs 2010?
Hope some body can help solving this...i`m new in the silverlight flow..
Best regards,
Mark
Mark wrote:
It looks cool overhere, but when i try to run this code in vs2010 i can`t drop a file in the webform..
I've made a simple silverlight 4 application copy and past the code you have written..and then run it on a windows 7 machine..ie9
Hope you can help with running this code?
Best regards,
Mark
Ron Richins wrote:
Let us compare, drag n' drop. Asp.NET, how (stateless)?
Silverlight (stateful), client side/server side events and commands.
Personally, I do not care where there are stored, as long as they are available the next time from this visitor, I can improve the response time for that individual.
Cory Seaman,
Just my opinion, but you are placing far too much emphasis on accessing an individuals personal computer. I love the fact that I can now utilized the cpu, video, and memory of the client personal computer (this includes: local cacheing, multi-core/parralell processing, local storage, and async push of "MY" everything).
The fact that, I do not have access to anything beyond, ("My Documents") should be construde as a positive. The operating system, has safe guards when launching a program. If the operating system has not seen this program before, the "Operating System and/or the ant-virus will catch it".
In both cases, your computer will ask you if this is allowed.
From me to you and everyone.
When in doubt, cancel.
If you recognize the requestor, and say okay. Absolutely, anything that you were not expecting to see, should be deemed a threat. Close immediately, If it will not close, immediately hold your finger on the power button, until every light is off of your computer.
When you restart your computer, you will get a warning message:
Safe (always safe, however, unable to access the internet).
Normal (ignores the loss of power, check point restart, and restarts as normal).
Ron
parv wrote:
I Liked it
Matt Eland wrote:
Seems to work fine for any random folder on my machine (though attempting to get directory information generates security exceptions).
I've heard this doesn't work as well on Macs. Is this true?
Cory Seaman wrote:
The functionality of the drag and drop feature is still, unfortunately, very limited, it would seem (through the RC version)...even when running out of browser you're still limited to a user's special folders like "My Documents". I wrote a sample app to .zip files, and the only ones the app has genuine access to are those dragged from the allowed handful of special folders. I think there's going to be some frustration when the meaning of this starts to become apparent to developers--drag and drop is such a promising feature!
Guide the car to its parking space in this fun Car Parking game.
Aim for the Trash Can and get the various items of Trash in the bin.
Fly your plane in this colorful vertical scrolling shoot-em-up. Blast the bad guys and collect any bonus's they leave behind.
Pop as many bubbles as possible in this fun and colorful bubble popping game. The levels start off easy enough but gradually get harder!
Here we have a bunch of monsters that need to be matched up. Look out for the bomb and spinning monsters that will cause special damage!
Guide your friendly Bird through the maze of pipes and other obstacles collecting the Stars in this cool arcade game inspired by the legendary Flappy Bird.
You are stranded on an Alien planet. Your goal is to build a space rocket and escape. Start by building units to create power and mine the metal patches. Build defenses to defend your base from the advancing Aliens and Zombies!
Play Pool against the computer or battle against your friends in the online mode!
Slice the fruit that is thrown up onto the screen. Slice the fruit into multiple pieces for maximum points!
Neesha wrote:
I'm unable to drag and drop file.I'm using vs2012.
MarkSilver wrote:
Hi,
I like this drag and drop with files..the only thing is that i can`t get it work on my machine
I've just made a simple silverlight application copy and paste your code, and run it...it runs ok but when i drag and drop a file nothing happens...is this because of a setting in ie9 ? or in vs 2010?
Hope some body can help solving this...i`m new in the silverlight flow..
Best regards,
Mark
Mark wrote:
It looks cool overhere, but when i try to run this code in vs2010 i can`t drop a file in the webform..
I've made a simple silverlight 4 application copy and past the code you have written..and then run it on a windows 7 machine..ie9
Hope you can help with running this code?
Best regards,
Mark
Ron Richins wrote:
Let us compare, drag n' drop. Asp.NET, how (stateless)?
Silverlight (stateful), client side/server side events and commands.
Personally, I do not care where there are stored, as long as they are available the next time from this visitor, I can improve the response time for that individual.
Cory Seaman,
Just my opinion, but you are placing far too much emphasis on accessing an individuals personal computer. I love the fact that I can now utilized the cpu, video, and memory of the client personal computer (this includes: local cacheing, multi-core/parralell processing, local storage, and async push of "MY" everything).
The fact that, I do not have access to anything beyond, ("My Documents") should be construde as a positive. The operating system, has safe guards when launching a program. If the operating system has not seen this program before, the "Operating System and/or the ant-virus will catch it".
In both cases, your computer will ask you if this is allowed.
From me to you and everyone.
When in doubt, cancel.
If you recognize the requestor, and say okay. Absolutely, anything that you were not expecting to see, should be deemed a threat. Close immediately, If it will not close, immediately hold your finger on the power button, until every light is off of your computer.
When you restart your computer, you will get a warning message:
Safe (always safe, however, unable to access the internet).
Normal (ignores the loss of power, check point restart, and restarts as normal).
Ron
parv wrote:
I Liked it
Matt Eland wrote:
Seems to work fine for any random folder on my machine (though attempting to get directory information generates security exceptions).
I've heard this doesn't work as well on Macs. Is this true?
Cory Seaman wrote:
The functionality of the drag and drop feature is still, unfortunately, very limited, it would seem (through the RC version)...even when running out of browser you're still limited to a user's special folders like "My Documents". I wrote a sample app to .zip files, and the only ones the app has genuine access to are those dragged from the allowed handful of special folders. I think there's going to be some frustration when the meaning of this starts to become apparent to developers--drag and drop is such a promising feature!