Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
425
DataPresenter and Tree
posted

Hello,

I am using the data presenter to drag a row from a grid to your tree component. It works fine. However, I am losing the ability to scroll in the tree when I am dragging the node. 

If I drag the node from the tree, it uses the internal auto scrolling of the tree when I am in the top and bottom part of the tree. 

Can you tell me how can I activate this feature?

Thank you

  • 34510
    Offline posted

    Hi infragisticsMaster,

    In my preliminary tests, it looks like the auto-scrolling behavior is internal to the control and only activates when used in conjunction with itself or another XamDataTree.  You can still replicate this behavior, however, by modifying the scroll value depending on the mouse position on the tree.  This code would be placed inside your DragOver/MouseMove event for the XamDataTree.

    const double scrollRegion = 20;
    Point pt = e.GetPosition(xamDataTree1);

    // This check is for the bottom portion of the tree.
    if (pt.Y > xamDataTree1.ActualHeight - scrollRegion)
    {
     // Store the current scroll value.
     IProvideScrollInfo scrollInfo = xamDataTree1 as IProvideScrollInfo;
     double lastScrollValue = scrollInfo.VerticalScrollBar.Value;

     // Reset the data source so scroll value is taken into account.
     xamDataTree1.ItemsSource = null;
     xamDataTree1.ItemsSource = boundDataSource;

     // The scroll value got reset to 0 so restore it.
     scrollInfo.VerticalScrollBar.Value = (lastScrollValue + 1);
    }
    // This check is for the top portion of the tree.
    else if (pt.Y < scrollRegion)
    {
     // Store the current scroll value.
     IProvideScrollInfo scrollInfo = xamDataTree1 as IProvideScrollInfo;
     double lastScrollValue = scrollInfo.VerticalScrollBar.Value;

     // Reset the data source so scroll value is taken into account.
     xamDataTree1.ItemsSource = null;
     xamDataTree1.ItemsSource = boundDataSource;

     // The scroll value got reset to 0 so restore it.
     scrollInfo.VerticalScrollBar.Value = (lastScrollValue - 1);
    }

    How are you handling the drag and drop?  Are you using our Drag and Drop framework or the default Microsoft implementation with System.Windows.DragDrop.DoDragDrop()?

  • 34510
    Offline posted

    Hello,

    I'm looking into your requirements and have reproduced the behavior your seeing.  I need to research this further and will update you on my progress by Thursday.