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

Drag RadTreeViewItem without make it selected

1 Answer 35 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Diego
Top achievements
Rank 1
Diego asked on 14 Jan 2010, 06:35 PM
Hi to all,
i just would like to drag a RadTreeViewItem on a different component without make it selected.
Right now i have tried different ways without success...

I have implemented the PreviewMouseLeftButtonDown handler when the item is prepared, so when the user just press down the mouse i store the treeviewitem and put the e.Handled = true just to leave it unselected. When the event PreviewMouseLeftButtonUp is fired i will get the stored element and make it selected (so no drag operation...just a normal click on the element).

The big problem is that the
e.PreparedItem.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(PreparedItem_PreviewMouseLeftButtonDown);

is sent different times..the first time the source is the "root" element of the RadTreeView the second time the first child of the root element and so on. I think it is not correct to fire so many events if i mouse down only on one RadTreeViewItem...i aspect to have directly on the first event the right treeviewitem on the source!

Do you have any idea how to implement this scenario?

Really Thanks.
Diego Bonura




1 Answer, 1 is accepted

Sort by
0
Accepted
Miroslav
Telerik team
answered on 20 Jan 2010, 09:13 AM
Hi Diego,

By default the dragged items are the selected items of the TreeView.

This can be changed by overriding the DragQuery and specifying that the dragged item will be the one that the mouse is mouse dragging.

I have attached a project demonstrates this.

Best wishes,
Miroslav
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.
Tags
TreeView
Asked by
Diego
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
Share this question
or