This is a migrated thread and some comments may be shown as answers.

Drag/Drop within a ListBox

4 Answers 166 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Damon
Top achievements
Rank 1
Damon asked on 25 Aug 2009, 08:01 PM
Is there an example of this for a WPF application.  I found an example for a silverlight example, but I am having trouble adapting it to WPF.

Any help is appreciated.

Thanks

Damon

4 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 27 Aug 2009, 03:18 PM
Hello Damon,

You can find an example attached. Give it a try and let me know how it works for you.

Best wishes,
Kiril Stanoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Bob Mills
Top achievements
Rank 2
answered on 30 Sep 2009, 08:01 PM
I have downloaded the example and tried to implement it in my project but the events are not firing.  How can I check to see if they are wired properly?
0
Miroslav
Telerik team
answered on 01 Oct 2009, 06:46 AM
Hello Bob Mills,

Unfortunately there is no way to check whether a handler for an event has been added (other than it firing).

I can suggest several things:
1. If you cannot add the handlers directly to the ListBoxes, add them to one of their visual parents. The handlers from the example should still work. In the example, you can replace the wiring with:

this.AddHandler(RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnDropQuery));  
this.AddHandler(RadDragAndDropManager.DragQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnDragQuery));  
this.AddHandler(RadDragAndDropManager.DropInfoEvent, new EventHandler<DragDropEventArgs>(OnDropInfo));  
this.AddHandler(RadDragAndDropManager.DragInfoEvent, new EventHandler<DragDropEventArgs>(OnDragInfo)); 

...and the drag-drop will still work.

2. Inherit the ListBox and add the handlers in its contstructor. This way you will know that they have been added for sure.

3. Add a debug class handler. Class handlers are handlers that fire at each instance of the given class for the event route. If you add a class handler for FrameworkElement, the handler will be called for each element that the event passes through and you will be able to see if the event does not reach its destination for some reason. To add a class handler for FrameworkElement, you can use this syntax:

EventManager.RegisterClassHandler(typeof(FrameworkElement),   
    RadDragAndDropManager.DragQueryEvent,   
    new EventHandler<DragDropQueryEventArgs>(OnDebugDragQuery)); 


All the best,
Miroslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Frédéric
Top achievements
Rank 1
answered on 15 Oct 2009, 02:16 PM
maybe you forgave to get back the configurations set inside the resource part of the demo

I had the same issue and solved it like that
Tags
DragAndDrop
Asked by
Damon
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Bob Mills
Top achievements
Rank 2
Miroslav
Telerik team
Frédéric
Top achievements
Rank 1
Share this question
or