I have a RadTreeView with some Containers and some Items (the items do not contain other items). When I activate Drag and Drop everything works fine. My problem is that I have some Containers that should not work as drop target. Unfortunatly I could not find an example.
First I tried the property IsDroppingAllowed (I used it like IsExpanded and IsSelected). Unfortunatly the getter is never called.
Than I tried "OnDragOver"
DragDropManager.AddDragOverHandler(this.FolderRadTreeView, new Telerik.Windows.DragDrop.DragEventHandler(OnDragOver), true);
It seems that I have to set
options.DropAction = DropAction.Move;
or
options.DropAction = DropAction.None;
and everything works fine. But after a while it drives me crazy. Is there anywhere a good example? Is there anywhere a checklist what I have to reimplement?
I tried to use the DropTargetItem to check if the dropping is allowed.
var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key)
as
TreeViewDragDropOptions;
var dropItem = options.DropTargetItem.Item;
(dropItem
as
IFolderItem).IsDroppable(options.DraggedItems));
If I drop inside everthing is fine. If I drop before (Telerik.Windows.Controls.DropPosition.
Before) it seems that my dropItem I used for IsDroppable() is not the container where the RadTreeView drops my item.
An other trapdoor it that I have to check that I do not drag an Item in itself (drag A and drop it in A or drop in a child of A).