Scrollbar fires DragInitialized

7 posts, 0 answers
  1. Martin
    Martin avatar
    7 posts
    Member since:
    Jun 2012

    Posted 13 Aug 2012 Link to this post

    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)

  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 16 Aug 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Martin
    Martin avatar
    7 posts
    Member since:
    Jun 2012

    Posted 21 Aug 2012 Link to this post

    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.
  5. Hristo
    Admin
    Hristo avatar
    352 posts

    Posted 24 Aug 2012 Link to this post

    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.

  6. Martin
    Martin avatar
    7 posts
    Member since:
    Jun 2012

    Posted 24 Aug 2012 Link to this post

    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...
  7. Hristo
    Admin
    Hristo avatar
    352 posts

    Posted 27 Aug 2012 Link to this post

    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.

  8. Martin
    Martin avatar
    7 posts
    Member since:
    Jun 2012

    Posted 12 Sep 2012 Link to this post

    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!
Back to Top
UI for WPF is Visual Studio 2017 Ready