RadTreeView & RadDragAndDropManager

5 posts, 1 answers
  1. rubenhak
    rubenhak avatar
    58 posts
    Member since:
    Dec 2008

    Posted 03 Dec 2009 Link to this post

    Hi,

    I'm using a RadTreeView with IsDragDropEnabled ="True" and need to limit dragging and dropping for certain items. Tried to attach to 
                RadDragAndDropManager.AddDragQueryHandler(...); 
                RadDragAndDropManager.AddDragInfoHandler(...); 
                RadDragAndDropManager.AddDropQueryHandler(..); 
                RadDragAndDropManager.AddDropInfoHandler(...); 
     
    and manipulate with e.QueryResult but it does not take any effect. All the items are allowed to be dragged and dropped anywhere inside the treeview. 

    I followed the sample and it does work for the GridView but doesn't on a TreeView.

    Thanks,
    Ruben.

  2. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 04 Dec 2009 Link to this post

    Hello rubenhak,

    Please check this help article:
    http://www.telerik.com/help/silverlight/radtreeview-features-drag-and-drop.html

    This article can also be of help:
    http://www.telerik.com/help/silverlight/raddraganddrop-events.html

    Please let us know if you need more help.

    Best wishes,
    Valentin.Stoychev
    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. rubenhak
    rubenhak avatar
    58 posts
    Member since:
    Dec 2008

    Posted 04 Dec 2009 Link to this post

    Hi Valentin,

    Thanks for the articles. It gives a better idea how does dragging and dropping implemented. However, still not clear how to control disallowing dropping on certain items on the treeview. It works fine when dragging from RadGridView to RadTreeView. When dragging/dropping inside a TreeView, the DropQuery event is not being fired at all.

    Thanks,
    Ruben.
  5. Answer
    Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 08 Dec 2009 Link to this post

    Hi Ruben,

    The message from the DropQuery event is handled by RadTreeView. Therefore, to receive the DropQuery event, you will have to subscribe for handled events too:

    public MainPage()
    {
        InitializeComponent();
        treeView1.AddHandler(RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(DragDropQueryEventHandler), true);
    }
     
    private void DragDropQueryEventHandler(object sender, DragDropQueryEventArgs e)
    {
        // add your custom logic here
    }

    The last parameter in treeView1.AddHandler allows you to listen for handled events. An important note is to add using Telerik.Windows; in your usings section.

    Give it a try and let me know how it works for you.


    All the best,
    Kiril Stanoev
    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.
  6. rubenhak
    rubenhak avatar
    58 posts
    Member since:
    Dec 2008

    Posted 08 Dec 2009 Link to this post

    Hi Kiril.

    Yes, it works. 

    Thanks,
    Ruben
Back to Top
UI for WPF is Visual Studio 2017 Ready