Drag and drop autoscroll

9 posts, 1 answers
  1. Erik
    Erik avatar
    36 posts
    Member since:
    Jun 2012

    Posted 17 Aug 2012 Link to this post

    Is it possible to automatically scroll a RadListBox when dragging an item over the top or bottom of the ListBox?
  2. George
    Admin
    George avatar
    1332 posts

    Posted 22 Aug 2012 Link to this post

    Hello,

    Yes, this functionality is supported out of the box with the RadListBox control. Please, download our latest internal build and let me know if this suits your needs.

    All the best,
    George
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

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

    Posted 24 Aug 2012 Link to this post

    In the code below I'm using a RadListBox, but it's doesn't autoscroll when dragging to the edges of the window. Am I missing something?

    <Window
        x:Class="ListBoxTest.MainWindow"
        Title="MainWindow" Height="500" Width="525">
        <telerik:RadListBox
            ItemsSource="{Binding MyCollection}">
            <telerik:RadListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock
                        Height="50"
                        Width="100"
                        Background="LightBlue"
                        telerik:DragDropManager.AllowCapturedDrag="True"
                        Text="{Binding .}"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Center"/>
                </DataTemplate>
            </telerik:RadListBox.ItemTemplate>
            <telerik:RadListBox.DragDropBehavior>
                <telerik:ListBoxDragDropBehavior/>
            </telerik:RadListBox.DragDropBehavior>
        </telerik:RadListBox>
    </Window>

    using System.Collections.ObjectModel;
     
    namespace ListBoxTest
    {
        public partial class MainWindow
        {
            public MainWindow()
            {
                InitializeComponent();
     
                DataContext = this;
     
                MyCollection = new ObservableCollection<string>
                {
                    "test text 1",
                    "test text 2",
                    "test text 3",
                    "test text 4",
                    "test text 5",
                    "test text 6",
                    "test text 7",
                    "test text 8",
                    "test text 9",
                    "test text 10",
                    "test text 11",
                    "test text 12",
                    "test text 13",
                    "test text 14",
                    "test text 15",
                    "test text 16",
                    "test text 17",
                    "test text 18",
                    "test text 19",
                    "test text 20",
                };
            }
     
            public ObservableCollection<string> MyCollection { get; private set; }
        }
    }

  5. Answer
    George
    Admin
    George avatar
    1332 posts

    Posted 27 Aug 2012 Link to this post

    Hello Erik,

     
    The autoscrolling feature is introduced with our internal build from 6.08 (August 6). If you use older binaries, it won't work. Please, note that using the given xaml, you need to click on the text in the ListBoxItems in order to drag the item. I prepared a sample with the binaries from 6.08 and add some code. You can find the project attached. Please, note that you can uncomment the Window resources in order to allow mouse capturing over the ListBox item, not only over the text.

    Hope this helps.

    All the best,
    George
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Erik
    Erik avatar
    36 posts
    Member since:
    Jun 2012

    Posted 28 Aug 2012 Link to this post

    Thanks autoscroll works with that build :)
  7. Shaun
    Shaun avatar
    31 posts
    Member since:
    Jul 2011

    Posted 11 May in reply to George Link to this post

    Hi George,

    I have taken a look at your sample above as I am having issues with auto scrolling on a RadListBox using the latest 2016 Q2 release.

    The WPF_Listbox.exe within the zip debug folder works as stated above however if I rebuild the project with the latest release it doesn't work any more.

    Could the example project above be updated to work the latest release so I can see how to implement if in my own project.

    Regards,

    Shaun

  8. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 16 May Link to this post

    Hello Shaun,

    Actually, there is a known issue regarding drag and scroll functionality of RadListBox - scrolling down does not work as expected when the items have height more than 22px.  So, in the concrete case, you will have to change the ItemTemplate and remove the height property of the Textbox:

    <DataTemplate>
        <TextBlock                
            Width="100"
            Background="LightBlue"
            telerik:DragDropManager.AllowCapturedDrag="True"
            Text="{Binding .}"
            VerticalAlignment="Center"
            HorizontalAlignment="Center"/>
    </DataTemplate>

    Please try it and let us know whether it is ok now.

    Regards,
    Yana
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  9. Shaun
    Shaun avatar
    31 posts
    Member since:
    Jul 2011

    Posted 16 May in reply to Yana Link to this post

    Hi Yana,

    I have tried with the example project and this works as expected now. However where I need to implement this in my project the list box items are always taller than 22px. Is there any work around or any ETA for a proper fix?

    Regards,

    Shaun

  10. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 17 May Link to this post

    Hi Shaun,

    I am afraid that at the moment we cannot commit to any timeframe for fixing this issue, however, I have logged it in our public Feedback Portal, where you could track its progress, here is the link:
    http://feedback.telerik.com/Project/143/Feedback/Details/191916-scrolling-down-while-dragging-does-not-work-for-radlistboxitems-with-height-more

    If you follow the item, you will receive a notification as soon as we start working on it.

    Regards,
    Yana
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for WPF is Visual Studio 2017 Ready