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

Scrollbar fires DragInitialized

6 Answers 92 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 13 Aug 2012, 12:42 PM
Hello Telerik,

I am using a RadTreeView like this:

<telerik:RadTreeView  IsVirtualizing="True" SelectionMode="Multiple" telerik:DragDropManager.AllowDrag="True" telerik:DragDropManager.AllowCapturedDrag="True">

My problem is, when a vertical scrollbar appears and I move the scroll thumb down with the mouse, it fires a DragInitialize event and thus won't scroll the tree,
How can I prevent the DragInitialize, when I am actually on the scrollbar?

Here is the call stack:
TreeMitTelerik.exe!TreeMitTelerik.MainWindow.OnDragInitialize(object sender, Telerik.Windows.DragDrop.DragInitializeEventArgs args)   Telerik.Windows.Controls.dll!Telerik.Windows.DragDrop.DragInitializeEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget)
Telerik.Windows.Controls.dll!Telerik.Windows.DragDrop.DragInitializer.StartDrag()
Telerik.Windows.Controls.dll!Telerik.Windows.DragDrop.DragInitializer.StartDragPrivate(System.Windows.UIElement sender)
Telerik.Windows.Controls.dll!Telerik.Windows.DragDrop.DragInitializer.DragSourceOnMouseMove(object sender, System.Windows.Input.MouseEventArgs e)

6 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 16 Aug 2012, 07:17 AM
Hi Martin,

The RadTreeView has a built-in drag/drop logic which is currently implemented through the RadDragAndDropManager. This is why it is best not to use the DragDropManager settings on the tree. Instead in order to customize the drag operations of the RadTreeView, you can use the drag-related properties and events exposed by the control or attach event handlers to the RadDragAndDropManager events. They shouldn't be triggered by a scroll operation.

Let me know if that helps.

Best regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Martin
Top achievements
Rank 1
answered on 21 Aug 2012, 08:40 AM
Thank you Tina,
indeed the RadDragAndDropManager doesn't have the scroll bar problem.
Though, as much as I read the documentation and try the examples, I think I am familiar with the events and the event args, but I still fail to understand at which event I can attach my DataObject (as in the DragInitializeEventArgs.Data in OnDragInitialize of the DragDropManager).

My scenario is:
I have a client-server application, and the tree will not do any modification to itself, it will rather ask the server for changes. Thus I need to store special information in the data object when dragging, and also access to the DataObject on drop.
I need to be able to
1) drag one or more nodes insider the tree
2) drop data from other WPF windows or from the Windows desktop
3) drag nodes from the tree to other WPF windows

I am still evaluating the RadTreeView. I like it pretty well so far, but I need to figure out how the drag and drop can be achieved, before I can decide if we can use it for our product, so I would be most grateful for a few hints.
0
Hristo
Telerik team
answered on 24 Aug 2012, 09:17 AM
Hello,

You could use the DragDropEventArgs(DragDropQueryEventArgs).Options.Payload property to transfer your custom data. TreeView automatically adds the dragged items inside this Options.Payload property during the DragQueryEvent. You could check what is populated by the TreeView and alter the information in the DragInfoEvent which is fired afterwards.

Hope this helps a bit. Let us know if you face other issues.

Kind regards,
Hristo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Martin
Top achievements
Rank 1
answered on 24 Aug 2012, 02:25 PM
Thank you Hristo, that works fine!
Though messing with the build-in drag and drop feels like a workaround, I think I can live with this solution.
back to evaluating...
0
Hristo
Telerik team
answered on 27 Aug 2012, 12:53 PM
Hello,

Actually this is the most powerful and straightforward way to alter/extend the DragDrop behavior of our TreeView control. Personally, I also admit that using these events is not the best solution we could offer and that we should improve the DragDrop logic and extensibility mechanism.

Kind regards,
Hristo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Martin
Top achievements
Rank 1
answered on 12 Sep 2012, 09:00 AM
I have the drag and drop running, it works fine inside the tree, to and from other WPF windows, and also from the desktop into the tree. I am absolutely happy with this solution, thank you for assisting!
Tags
TreeView
Asked by
Martin
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Martin
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or