Notification when the treeview gets re-arranged after dropping

4 posts, 0 answers
  1. Lauren Nickerson
    Lauren Nickerson avatar
    52 posts
    Member since:
    Jul 2009

    Posted 06 Apr 2010 Link to this post

    Hello.

    Like the title says, I need a notification when the drag and drop operation is finished and the dropped item has been moved to it's correct position, this is because I need the new position of the item.

    I'm not using the native D&D in the RadTreeView, but I'm using the RadDragAndDropManager to handle my D&D. Also as I was told here that in order to handle the D&D on my own I have to set the e.Handled to true in the PreviewDragEnded event.

    So basically I just need an event that happens after:

    1) The drop has finished
    2) The tree view has been rearranged to update the new position of the dropped item

    At that point, I should be able to find the dropped item and call this to get its new coordinates (reference):

    GeneralTransform generalTransform = droppedItem.TransformToVisual( parentElement );
    Point childToParentCoordinates = generalTransform.Transform( new Point( 0, 0 ) );

    Let me know if this is possible. Thanks!

  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 09 Apr 2010 Link to this post

    Hello Lauren Nickerson,

    If you need the coordinates of the point where you are dropping your items, you can handle the OnDropInfo() event and use the e.Options.CurrentDragPoint and e.Options.RelativeDragPoint properties to get the absolute and relative coordinates.

    Also, I am not really sure if I understand your scenario correctly? Do you need the dragged items to be moved or copied?
    If you need to copy the dragged items, you will have to handle the PreviewDragEnded() event and move your logic from the DragEnded() to the OnDropInfo() event because the former will not be called.

    However, if you only want to move your items, you don't need to handle the PreviewDragEnded() event. You will only have to handle the OnDropInfo() event, where you can check the e.Options.Status property and insert your logic whenever the status is DropComplete.

    I prepared an example for you to take a look at. Please let me know if this works for you or if you need more info.

    Greetings,
    Tina Stancheva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Lauren Nickerson
    Lauren Nickerson avatar
    52 posts
    Member since:
    Jul 2009
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 12 Apr 2010 Link to this post

    Hello Lauren Nickerson,

    I am very sorry for that.

    I have left out the reference to the Telerik.Windows.Data.dll and this was causing the problem. I reattached the example, can you please try to run it now?

    Greetings,
    Tina Stancheva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top