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

DragDrop Files from desktop to treeview

5 Answers 129 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Vinodh
Top achievements
Rank 1
Vinodh asked on 21 Feb 2011, 09:45 AM
I am using Telerik controls with version 2010.3.1314.35.

In my WPF application , i need to have a treeview which accepts files/folders drag and dropped from desktop or any other windows folders.

Also while dragging over the treeview nodes i need to expand the nodes after a particular time delay.

Above two features are available with Telerik treeview?

If not please suggest any possible workaround solution.

Regards,
Vinodh

5 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 24 Feb 2011, 12:55 PM
Hello Vinodh,

Please accept our apologies for the delayed response.
We are now working on solving your scenario and we will contact you in the next few hours.

Regards,
Petar Mladenov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Petar Mladenov
Telerik team
answered on 24 Feb 2011, 05:57 PM
Hello Vinodh,

Currently this cannot be achieved easily with the RadDragAndDropManager events or with RadTreeView`s drag and drop events. However, we created a solution that uses the events that are inherited from the WPF`s TreeView: Drop and DragOver. Please examine it and let us know if it satisfies your needs. 

All the best,
Petar Mladenov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Vinodh
Top achievements
Rank 1
answered on 25 Feb 2011, 06:18 AM
Hello Petar Mladenov,

Thanks very much for your reply.

This what i exactly required.

Two more things i need are,
1. When i drag the external item down the treeview , i can't scroll down
2. While dragover an item it immediately expands ( but in my case i need a time delay and then expand the child items)

Regards
Vinodh
0
Petar Mladenov
Telerik team
answered on 02 Mar 2011, 02:17 PM
Hi Vinodh,

For the time delay  you can use a Thread.Sleep method like so:
void PreparedItem_DragOver(object sender, DragEventArgs e)
       {
           var currentItemUndeMouse = sender as RadTreeViewItem;
           if (currentItemUndeMouse != null && !currentItemUndeMouse.IsSelected)
           {
               currentItemUndeMouse.IsSelected = true;
               System.Threading.Thread.Sleep(300);
               currentItemUndeMouse.IsExpanded = true;
           }
           e.Handled = true;
       }
As for the second, ScrollViewer problem, you can try to use the mouse events and to calculate the mouse position and to check whether the ScrollViewer can scroll down.

Greetings,
Petar Mladenov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Vinodh
Top achievements
Rank 1
answered on 03 Mar 2011, 07:15 AM
Hi Petar Mladenov,

Thanks for your suggestions.

I tried it, and it worked. 
Instead of calling System.Threading.Thread.Sleep(300); in the PreparedItem_DragOver() event,
we can call a method in a Thread which will wait for a time delay and check if still the same item 
is selected by the user. if so then expand that item.
if user has moved the cursor to next item then don't expand the previous item.


Thank you very much for your efforts.
Tags
TreeView
Asked by
Vinodh
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Vinodh
Top achievements
Rank 1
Share this question
or