How getting notified when an element beeng draged is droped ?

Posted on 2011-05-04
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:fara2000
    LVL 11

    Expert Comment

    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

    Does my solution help you?

    Author Comment

    Not yet! . Iam still trying. Soon I'lll  return back to you!!

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    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.…

    758 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

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now