I'm currently using a RadTreeView with drag and drop function enabled. I implemented the dragended event with business logic for saving the changed stucture of the tree into the database. But I don't want to use the dropbefore and dropafter, how can I disable these actions.
I've read previous post about disabling the drop before and drop after which was created in 2009.
This blog says that it will be possible in the next service pack (which must be released by now). But I can't figure out how.
Thanks in advance
6 Answers, 1 is accepted
I prepared a sample project for you illustrating the desired approach. It basically follows this documentation article. Please let us know if this is exactly what you've expected. You can also check out the RadDragAndDropmanger help articles and demos.
the Telerik team
The solution you provided works with a code behind file. What I forgot to say was that I'm using telerik with the MVVM design pattern and Caliburn.Micro. If I attach the handler the way you provided it give me the following error: "Cannot convert from Telerik.windows.RoutedEvent to System.Windows.RoutedEvent".
In your solution you checked if the dropPosition is inside and ignore any other dropPostionType. I used that part in the workaround I currently have, which is:
Within the RadTreeView I disabled the previewLine and Tooltip.
I implemented the DragEnded en PreviewDragEnded events for the RadTreeView in my ViewModel
In the implementation of the PreviewDragEnded I set the DropPosition to DropPosition.Inside
And in my DragEnded implementation the dropPostion is now always DropPosition,Inside
Please verify my findings. Hopefully, you can provide a good workaround. Thanks, ~Rick
I'm not sure I understand what you mean. I tested Peter's solution and I didin't encounter any difficulties while trying to drop inside any of the items. Can you please have a look at this screencast and let me know if I've missed something.
Also, can you please check if your browser is zoomed, as in older versions of the RadTreeView control, this used to cause issues when calculating the mouse position based on which the DragTooltip is displayed.
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Just wanted to thank you for sharing this little piece of code, which helped me solved my own problem:
In other words, to cancel having the Inside position and have only Before and After positions with a smooth transition between them (no gap).
I don't think I would have thought about it by myself otherwise... so thanks again for sharing.