This is a migrated thread and some comments may be shown as answers.

Drag and Drop - Change colour of horizontal drag line

1 Answer 83 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 16 Jan 2009, 10:35 PM
How do you change the colour of the horizontal line (and the icon to the left of that line) that shows where a drop will occur during a drag/drop process in the treeview?

How can the drop options in a treeview be limited, such that for a particular node a drop action will only be allowed to create a sibling of that node or for a different treeview node a drop action will only be able to create a child node?

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 19 Jan 2009, 03:01 PM
Hello Barry,

Thanks for writing.

The color of the horizontal line can be changed by setting the DropFeedbackColor property of RadTreeView.

The Drag&Drop restrictions can be made by subscribing to the DragOverNode event of the RadTreeView and setting the RadTreeViewDragCancelEventArgs Cancel property to true depending on the RadTreeViewDragCancelEventArgs Direction property. The following code snippet restricts a node so that only children nodes can be added to it:

void radTreeView1_DragOverNode(object sender, RadTreeViewDragCancelEventArgs e)  
{  
    if (e.TargetNode.Text == "Node2" && e.Direction != Telerik.WinControls.ArrowDirection.Right)  
    {  
        e.Cancel = true;  
    }  

Note that Windows Forms also has an enum called ArrowDirection, thus you need to use the fully qualified name of the enum.

Please write again if you have further questions.

All the best,
Victor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Treeview
Asked by
Barry
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or