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

Prevent SelectionChanged when Drag item

2 Answers 45 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Nalaka
Top achievements
Rank 1
Nalaka asked on 09 Feb 2015, 04:28 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 09 Feb 2015, 11:06 AM
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.

 
0
Nalaka
Top achievements
Rank 1
answered on 10 Feb 2015, 05:09 AM
Hi Martin,

Thank you. It works.
Tags
TreeView
Asked by
Nalaka
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Nalaka
Top achievements
Rank 1
Share this question
or