How getting notified when an element beeng draged is droped ?

Posted on 2011-05-04
Medium Priority
Last Modified: 2013-11-12
With Expression Blend 4 it's possible to drop a MouseDragBehaviour to an element from the asset. With this regard I have two Questions:
1) How can I catch the drop event of this element when it is released over a container  such as grid or canvas?
2) How can produce the same actions(Drag and drop) of the element by code (C#)
Iam Working with Silverlight 4!
thanks in advance!
Question by:bish wakim
  • 2
  • 2
LVL 11

Expert Comment

ID: 35693557
Have the grid or canvas handle the Drop event.

for example:
canvas.Drop += ...
(or register the event on XAML).

For doing the same in code, you will to set AllowDrop=true on your Drag Scope, and when you start dragging, call DragDrop.DoDragDrop.

For having the effect that something is being dragged (You see a half transparent copy of what you are dragging), you need to create a VisualBrush of what you are dragging and draw it on an adorner.

See my reply and example here:

If you can't see the answer and don't wanna spend points then look at the the attachment I uploaded at that time which shows drag and drop in WPF:

LVL 11

Accepted Solution

saragani earned 2000 total points
ID: 35705733
Does my solution help you?

Author Comment

by:bish wakim
ID: 35715519
Not yet! . Iam still trying. Soon I'lll  return back to you!!

Author Closing Comment

by:bish wakim
ID: 35799828

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question