There is an IsDropAllowed property but no IsDragAllowed, have I missed it or an equivalent property or will I have to revert to a coding solution?
Thank you,
1 Answer, 1 is accepted
0
Martin Ivanov
Telerik team
answered on 24 Oct 2014, 09:14 AM
Hi Tjaart,
The default drag and drop behavior of RadTreeView uses our DragDropManager to implement its logic. The manager have AllowDrag (and AllowCaptureDrag) attached properties which are set on the RadTreeViewItems and determines if the item can be dragged. However, if a child property have this property set to false, the drag events will bubble to its parent.
In order to forbid the drag of an item you can subscribe for the DragInitialize event of DragDropmanager and inside its handler set the Data and the DragVisual to null. Here is an example in code:
var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) asTreeViewDragDropOptions;
if (options != null)
{
if (the currently prepared item should not be dragged)
{
e.Data = null;
e.DragVisual = null;
}
}
}
Regards,
Martin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.