TreeView - Detect the node on which anything was dropped (drag and drop) #7882
Answered
by
castorix
gautambjain
asked this question in
Q&A
-
I using the Drop event to detect when anything is dropped from another ListView. In a TreeView, how do I know the exact TreeViewNode item on which the drop event occurred? Please help. |
Beta Was this translation helpful? Give feedback.
Answered by
castorix
Nov 4, 2022
Replies: 1 comment 1 reply
-
You can use VisualTreeHelper.FindElementsInHostCoordinates in Drop event (then DataContext to get Node) A test with a TextBlock dropped in a TreeView (I used GetCursorPos + ScreenToClient to get coordinates) : |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
gautambjain
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use VisualTreeHelper.FindElementsInHostCoordinates in Drop event (then DataContext to get Node)
A test with a TextBlock dropped in a TreeView (I used GetCursorPos + ScreenToClient to get coordinates) :