Hi
I would like to implement a functionality that would allow me to drag an html element from the page (like image) over my silverlight container which includes a grid and change the mouse indicator to hint that it would be possible to drop an item into a cell of the grid. On dropping, some part of the information (like an ID value from img tag) would be pasted into the cell.
Can you please explain how this can be achieved, preferably with some example code.
Thanks
So to be very clear here:
- The Infragistics Drag and Drop framework is for within a Silverlight app only. It cannot reach out to the HTML in the browser.
- Silverlight 4 added the ability to drag and drop objects from Windows shell onto the Silverlight player.
- It might be possible to drag and drop HTML elements onto the Silverlight player using Silverlights HTML DOM bridge.
Basically you would have to use JavaScript to detect that the HTML element was dragged onto the Silverlight player, which the browser sees as an <object>, not specifically as the Silverlight player. You could use our client-side drag and drop framework which is part of our ASP.NET controls product to help with this.
Once a drag was detected you could use the HTML bridge to tell your Silverlight app what was dragged and how to react.
What I'm not sure you can do is use the bridge to figure out specifically what SL element your over. I'm not sure if during the HTML element drag operation the SL mouse events will still fire. If they do, then you could use the HTML bridge to send information about what Silverlight element is currently being hovered over back out to JavaScript and react accordingly there.
Hope that helps get you on your way.
Devin
That is correct.
-SteveZ
Just to make sure I understood you correctly, SL Drag & Drop functionality is for within Silverlight only, and it is not possible to drag anything from the host html page, be it image, html or plain text?
I was just informed that the the AllowDrop functionality of Silverlight is for dropping files from your desktop only.
Which is why it wouldn't work when i tried an html image.
You can use our SL Drag & Drop framework for operations regarding other SL elements. However, it won't be possible drag html on to the xamGrid and be notified.
It should also be noted that the mouse cursor is different when dragging a file over the silverlight grid indicating that the action is allowed, while attempting to drag anything from the host page itself will show not allowed icon.
If anyone has any idea why this is like it is, please step forward.