Am having RadGridView and RadTreeView. Am dragging & dropping items from the GridView to different the nodes of a Treeview. This is working fine. We have used "IsDragDropEnabled="True" in RadTreeView for performing task. In the same time am able to rearrange the nodes(performing drag & drop within different nodes of same RadTreeView). This i would like to stop. Please have a look on the attached image for your reference.
Thanx in advance.
--Sandy
5 Answers, 1 is accepted
You might want to check this help article - http://www.telerik.com/help/silverlight/radtreeview-how-to-disable-drop-specific-location.html.
All the best,Tsvyatko
the Telerik team
We had a requirement as follows:
An item can be moved around among its sibilings below the same parent only.
if (e.TargetDropItem != null && draggedItems != null && draggedItems.Count > 0 )
{
Node targetNode = (Node)(e.TargetDropItem.Header);
if (e.TargetDropItem.ParentItem != null && targetNode != draggedItems[0] as Node)
{
if (e.DropPosition == DropPosition.After || e.DropPosition == DropPosition.Before)
{
if (targetNode.ParentNode != (draggedItems[0] as Node).ParentNode)
{
e.TargetDropItem.ParentItem.IsDropAllowed = false;
}
else
{
e.TargetDropItem.ParentItem.IsDropAllowed = true;
}
}
else if (e.DropPosition == DropPosition.Inside)
{
if (e.TargetDropItem == draggedItems[0] ||
targetNode != (draggedItems[0] as Node).ParentNode)
{
e.TargetDropItem.IsDropAllowed = false;
}
else
{
e.TargetDropItem.IsDropAllowed = true;
}
}
else
{
e.TargetDropItem.IsDropAllowed = false;
}
}
else
{
e.TargetDropItem.IsDropAllowed = false;
}
}
The problem is that when we drag the last treeview item downwards, the e.dropitem is self but the visual indication is displayed below the root treeview item. On mouseup, the item is dropped as a sibiling to the root treeview item.
Please advice
Thanks
Jay
Hi,
i want dragdropEnable = true for tree view. But dropping in other control not in tree view.
I have tried with
<telerik:RadTreeViewItem Header="Tennis" IsDropAllowed="False">
but how could this achieve with tree source given with hirachical data source.
Then I have tried with
DragDrop.
DragDropManager.AddDropHandler(tvDeviceExplorerModel, AddressOf OnDropE, True)
'tvDeviceExplorerModel >> tree control name
Private Sub OnDropE(sender As Object, args As Telerik.Windows.DragDrop.DragEventArgs)
DirectCast(sender, Telerik.Windows.Controls.RadTreeView).AllowDrop = False
End Sub
here instead of AllowDrop = False I want some event by which I can cancel the drop tree node within tree node.
Please help me on same.
Thanks in advance.
You can handle the DragOver event and set the Effects to None if you don't want the drop to be enabled.
Hope this helps!
Nik
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
That work for me as required.