Drap/Drop Item's Parent

5 posts, 1 answers
  1. Ziad
    Ziad avatar
    13 posts
    Member since:
    Apr 2009

    Posted 13 Jan 2010 Link to this post

    Hello,

    I want to perform my own custom logic whenever an item is dragged/dropped. This procedure requires me to access the item's parent. I noticed that when I drag items and then drop them, in the RadTreeView.DragEnded event, the item's ParentItem property becomes null and the FullPath string property is also cleared.

    Is this the correct event to handle for my custom logic (i.e. performing the "drop" in the business logic)? If so, how can I get the item's parent before it was dragged (i.e. its current parent).

    Thank you.
  2. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 13 Jan 2010 Link to this post

    Hello Ziad,

    You can handle the PreviewDragStarted event adn to check there the ParentItem property.

    Sincerely yours,
    Valentin.Stoychev
    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. Ziad
    Ziad avatar
    13 posts
    Member since:
    Apr 2009

    Posted 13 Jan 2010 Link to this post

    The parent item does indeed appear in that event. However, I want an event where I can implement my "drop" logic. For example, the drag started event is fired as soon as the drag starts. So the user might end up dragging an item and then canceling the drag or picking an invalid item to drag into. Is there an event that is only called when the item is being dropped? The drag ended event that I chose to handle is only fired when a drop is successful.
  5. Answer
    Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 13 Jan 2010 Link to this post

    Hello Ziad,

    Actually in your case it will be best if you use the PreviewDragEnded event. When this event is raised the dragged items are still not removed from their original parents and you can implement your logic there.

    Sincerely yours,
    Valentin.Stoychev
    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. Ziad
    Ziad avatar
    13 posts
    Member since:
    Apr 2009

    Posted 14 Jan 2010 Link to this post

    Thank you Valentin, the PreviewDragEnded event works as expected.
Back to Top
UI for WPF is Visual Studio 2017 Ready