Drag/Drop within a ListBox

5 posts, 0 answers
  1. Damon
    Damon avatar
    3 posts
    Member since:
    Jan 2009

    Posted 25 Aug 2009 Link to this post

    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
  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 27 Aug 2009 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Bob Mills
    Bob Mills avatar
    28 posts
    Member since:
    Aug 2009

    Posted 30 Sep 2009 Link to this post

    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?
  5. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 01 Oct 2009 Link to this post

    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.
  6. Frédéric De Lène Mirouze
    Frédéric De Lène Mirouze avatar
    14 posts
    Member since:
    Sep 2009

    Posted 15 Oct 2009 Link to this post

    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
Back to Top
UI for WPF is Visual Studio 2017 Ready