DragDrop Files from desktop to treeview

6 posts, 0 answers
  1. Vinodh
    Vinodh avatar
    3 posts
    Member since:
    Feb 2011

    Posted 21 Feb 2011 Link to this post

    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
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 24 Feb 2011 Link to this post

    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!
  3. UI for WPF is Visual Studio 2017 Ready
  4. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 24 Feb 2011 Link to this post

    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!
  5. Vinodh
    Vinodh avatar
    3 posts
    Member since:
    Feb 2011

    Posted 25 Feb 2011 Link to this post

    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
  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 02 Mar 2011 Link to this post

    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!
  7. Vinodh
    Vinodh avatar
    3 posts
    Member since:
    Feb 2011

    Posted 03 Mar 2011 Link to this post

    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.
Back to Top
UI for WPF is Visual Studio 2017 Ready