Drag and Drop - Change colour of horizontal drag line

2 posts, 0 answers
  1. Barry
    Barry avatar
    18 posts
    Member since:
    Jul 2008

    Posted 16 Jan 2009 Link to this post

    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?
  2. Victor
    Victor avatar
    1358 posts

    Posted 19 Jan 2009 Link to this post

    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,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top