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

DragDrop files from Windows Explorer

5 Answers 138 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 20 Nov 2009, 08:53 AM
Hi,

I'm creating an application that will allow users to drag and drop files from Windows explorer into a RadTreeView.  I have been unable to highlight a node as a drop target when a file is dragged over it.  Is this possible?

Ideally I would like to determine which node the user is hovering over when dragging the file, hightlight the node and change the drop icon to either an allow or disallow icon depending on the node tag.

Many thanks,

Joe

5 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 23 Nov 2009, 09:57 AM
Hello Joe,

You can determine which node is under your cursor with the following MouseMove handler:
private void radTreeView1_MouseMove(object sender, MouseEventArgs e)
{
    RadElement elementAtPoint = radTreeView1.ElementTree.GetElementAtPoint(e.Location);
    if (elementAtPoint is TreeNodeUI)
    {
        TreeNodeUI nodeUI = (elementAtPoint as TreeNodeUI);
        nodeUI.BorderColor = Color.Red;
        RadTreeNode node = nodeUI.AssociatedTreeNode;
        // Handle conditions based on node.Tag.
    }
}

Please note however that you will have to revert the border color to the previous value when the mouse moves over a new node. Write again if you need further assistance.

Regards,
Victor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Joe
Top achievements
Rank 1
answered on 23 Nov 2009, 10:21 AM
Hi Victor,

Thanks for the response. 

I would like to mimic/fake a node mouseover in order to highlight the node in exactly the same way it is highlighted when a use moves the mouse over a tree node.  Is this possible?

Thanks,

Joe
0
Victor
Telerik team
answered on 23 Nov 2009, 03:05 PM
Hello Joe,

Thank you for the question. This is possible, you just need to set the appropriate settings. Currently, for a hovered node, they are:
nodeUI.BackColor = Color.FromArgb(255, 231, 162);
nodeUI.NumberOfColors = 1;
nodeUI.BorderColor = Color.FromArgb(255, 189, 105);

Please note that these settings are applicable to TreeNodeUI type, not RadTreeNode. Also these are the settings from the ControlDefault theme. If you are using a different theme and you would like to determine the settings you can do so with the Visual Style Builder tool or with the aid of RadControlSpy tool.

Please write again if you need further assistance.

Best wishes,
Victor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Joe
Top achievements
Rank 1
answered on 23 Nov 2009, 03:14 PM
Hi Victor,

That works great, thank you :)

Joe
0
Accepted
Victor
Telerik team
answered on 23 Nov 2009, 05:06 PM
You are welcome, Joe! Feel free to mark this thread as answered.
If you need further assistance we are ready to assist you.

 
Sincerely yours,
Victor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Treeview
Asked by
Joe
Top achievements
Rank 1
Answers by
Victor
Telerik team
Joe
Top achievements
Rank 1
Share this question
or