I have been searching for a way to do this for a couple of days now, does anyone know if there is a way to turn off droping between nodes when doing drag and drop on a radTreeView, in my case there are parent nodes already created and all the nodes that will be dragged in have to go in one of these parent nodes, i cant allow them to place a node between two of the parent nodes.
Thanks
10 Answers, 1 is accepted
Would you please shed some more light on your requirements, in order to help us give you proper guidelines? Well, you have a RadTreeView with two parent nodes and you are dropping additional nodes in. You want to prevent the new nodes from going on one an the same level with the parent nodes, am I right? Do you expect the new nodes to be draggable once after they have been dropped in the RadTreeView? Where do you get the dragged nodes from?
Regards,
Ivan Ivanov
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

i have the same problem. I have a RadTreeView and on the dragover event i check if the item can drop into this parent. If not allowed then i set the dropeffects to DragDropEffects.None, else DragDropEffects.Copy. That works fine. The cursor is on a Parent the "copycursor" and on a Parent.Parent the "notallowed" cursor, perfect! BUT between a parent.parent and an other parent.parent the cursor switches to "copycursor". So the user could think he can drop, that is wrong.
I can turn off this, if i call the dodragdrop methode with allowed effects == None, but then i never get the "copycursor". My dodragdrop methode looks currently like this:
System.Windows.DragDrop.DoDragDrop(_treeView, dataObject, DragDropEffects.None| DragDropEffects.Copy);
Whats wrong or what can i do that the cursor is only "copycursor" on the allowed parents and not between not allowed parents?
Thanks
Annett

has anyone an idea?
_radTreeView.HideBetweenItemsDragCue() doesn't work.
Property EnableDragAndDropBetweenNodes doesn't exist in Telerik.Windows.Controls.Navigation.
Annett
Could you please send us a captured video of what you are trying to achieve ? Any sample code would also be highly appreciated since this way we would be better able to investigate this and provide you a solution or advice. Thank you for your cooperation.
Regards,Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

i copied the code from the Drop and Drag Manager. I will create a video, i put todays evening the video to the net an post the link.
Here the code:
DragManager
/// <summary>
/// Starts the drag operation.
/// </summary>
private void StartDrag()
{
if (_treeView != null)
{
IsDragging = true;
var ctx = _treeView.DataContext as ContextViewModel;
if (ctx != null)
{
var dataObject = ctx.SelectedItemsDataObject;
{
if (dataObject != null)
{
System.Windows.DragDrop.DoDragDrop(
_treeView, dataObject, DragDropEffects.Copy);
}
}
}
IsDragging = false;
}
}
DropManager
private void TreeViewDragOver(object sender, DragEventArgs e)
{
if (e.OriginalSource != null && typeof(TextBlock).IsInstanceOfType(e.OriginalSource))
{
RadTreeViewItem tvi = GetTreeViewItemFromChild(e.OriginalSource as DependencyObject);
if (tvi != null)
{
var item = tvi.Header;
DragItem = item;
}
SetDragDropEffects(e);
e.Handled = true;
}
}
private void SetDragDropEffects(DragEventArgs e)
{
e.Effects = DragDropEffects.None;
if (e.Data.GetDataPresent(typeof(AddressRepresentation[]).FullName))
{
if(_dragManager.IsDragging)
{
if (_treeView.ContextViewModel.CanDrop(DragItem, e.Data.GetData(typeof(AddressRepresentation[]).FullName, true) as AddressRepresentation[]))
{
e.Effects = DragDropEffects.Copy;
}
}
}
}
static RadTreeViewItem GetTreeViewItemFromChild(DependencyObject child)
{
if (child != null)
{
if (child is RadTreeViewItem)
{
return child as RadTreeViewItem;
}
else if (child is TreeView)
{
return null; //we've walked through the tree. The source of the click is not something else
}
else
{
DependencyObject par = null;
if (child is Visual || child is System.Windows.Media.Media3D.Visual3D)
par = VisualTreeHelper.GetParent(child);
else
par = LogicalTreeHelper.GetParent(child);
return GetTreeViewItemFromChild(par);
}
}
return null;
}

the video you can see under: http://www.annett-tempel.de/videos/dragtest.swf
The item "L.01 Lampe" can dropped only in "01 Gruppe". If i drag over Gruppe i have a
copycursor if a drag over Anlage or System i have a nonecursor. Thats ok. But if i drag between System and Anlage i
have a copycursor. This cursor is wrong. it must be a nonecursor. I dont know how i can i turn off the
copycursor between items.
Hope now its clear what my problem is.
Annett
I prepared a project for you where I used the RadDragAndDropManager.DragQuery event. In its handler I check the type of the target Item and set e.QueryResult = false if I want to disable the drop operation.You can test it like so: drag a file over a Folder with Name Starting with "Folder" and see that the drop is disabled. Please check out this solution and let us know if it could fit in your scenario.
Kind regards,Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

i checked this out. The e.Options.Destination is always NULL. I think this could be the problem. Have i forgotten something? What must i do that destination is not null?
Annett

Is it possible for you to send us an isolated sample showing the problem? This way we would be better able to investigate this and configure the RadDragAndDropManager events in the right way. Thank you for your cooperation in advance.
All the best,Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>