DragDrop Scrolls Through ListBox Too Quickly

4 posts, 0 answers
  1. Corey
    Corey avatar
    26 posts
    Member since:
    Nov 2012

    Posted 18 Mar 2015 Link to this post

    I have a System.Windows.Controls ListBox with a decent number of items within it (say around 50).  I have implemented drag and drop controls with the ListBox through the use of RadDragAndDropManager.  However, the problem we are having is that when a user selects a ListBoxItem and tries to reorder it by dragging it to its desired position, the ListBox scrolls much too quickly to easily and accurately place the dragged item in its desired spot.

    It seems like the sensitivity for scrolling the ListBox while dragging an item is too high.  Is there any way to slow down this scrolling behavior for easier drag and drop placement?  Currently, we have instituted buttons to allow for simply moving an item up and down in the ListBox, one row at a time, but that can be tiresome with larger lists of items.
  2. Nasko
    Admin
    Nasko avatar
    586 posts

    Posted 23 Mar 2015 Link to this post

    Hi Corey,

    The observer behavior is not caused by the DragDropManager, but by the ListBox control. What we could suggest you is instead ListBox to use RadListBox. You could modify the default RadListBoxStyle and by setting greater ScrollingSettingBehavior.ScrollStepTime and/or smaller ScrollingSettingBehavior.ScrollStep the scrolling will be slower and/or starting after less pixels:
    <Style TargetType="telerik:RadListBox" BasedOn="{StaticResource {x:Type telerik:RadListBox}}">
        <Setter Property="telerik:ScrollingSettingsBehavior.ScrollStep" Value="20" />
        <Setter Property="telerik:ScrollingSettingsBehavior.ScrollStepTime" Value="00:00:00.10" />
    </Style>

    Hopes this helps.

    Regards,
    Nasko
    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.

     
  3. DevCraft banner
  4. Corey
    Corey avatar
    26 posts
    Member since:
    Nov 2012

    Posted 23 Mar 2015 in reply to Nasko Link to this post

    Thanks for the reply and pointing me in the right direction.  I switched our control over to a RadListBox like you suggested, but since we do all of our work programmatically, I implemented your solution with the following code:

    RadListBox listBox = new RadListBox();
    listBox.SetValue(ScrollSettingsBehavior.ScrollStepProperty, 20.0);
    listBox.SetValue(ScrollSettingsBehavior.ScrollStepTimeProperty, new TimeSpan(0, 0, 0, 10));

    However, changing those values (making ScrollStep smaller or ScrollStepTime longer) did not seem to have any noticeable effect.  While dragging a RadListBoxItem inside of it, it immediately jumps to the bottom of the ScrollView unless you are incredibly slow with your mouse movements.

    Any additional help would be greatly appreciated.  Did I implement your solution in the code-behind correctly?
  5. Nasko
    Admin
    Nasko avatar
    586 posts

    Posted 24 Mar 2015 Link to this post

    Hi Corey,

    Yes, this is the correct way to set the ScrollStep and ScrollStepTime properties in code-behind. Could you please provide us some more additional information about your scenario? Sending us a code snippet of the declaration and settings of the other properties of RadListBox and how the drag-drop functionality is enabled will be of great help in our further investigation. Thus we could provide you with a prompt solution if possible. Also, please check this article from our help documentation that provides a detailed information about the drag-drop functionality of RadListBox. Please, check if you hadn't missed something,

    We're looking forward to hearing from you.

    Regards,
    Nasko
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top