Prevent SelectionChanged when Drag item

3 posts, 1 answers
  1. Nalaka
    Nalaka avatar
    12 posts
    Member since:
    Mar 2014

    Posted 08 Feb 2015 Link to this post

    Hi,

    I'm using RadTreeView and RadScheduleView. I want to drag items from the tree view and drop into appointment in the ScheduleView. But the problem is when I start drag item in the tree, it will be selected. I want to prevent this selection when I drag item(That means click and holds the mouse left button). But for normal left button click it should be selected. Any ideas how to achieve this?
  2. Answer
    Martin
    Admin
    Martin avatar
    1101 posts

    Posted 09 Feb 2015 Link to this post

    Hi Nalaka,

    In order to achieve your requirement you can deselect the currently selected item in the DragInitialize event handler of the DragDropManager. Here is an example:
    DragDropManager.AddDragInitializeHandler(this.tree, OnTreeDragInit, true);
    //......
    private void OnTreeDragInit(object sender, DragInitializeEventArgs e)
    {           
        var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;
        if (options != null)
        {
            options.DragSourceItem.IsSelected = false;
        }
    }
    Please let me know if this helps.

    Regards,
    Martin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
  4. Nalaka
    Nalaka avatar
    12 posts
    Member since:
    Mar 2014

    Posted 09 Feb 2015 in reply to Martin Link to this post

    Hi Martin,

    Thank you. It works.
Back to Top