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

Drag and drop autoscroll

8 Answers 158 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 1
Erik asked on 17 Aug 2012, 10:32 AM
Is it possible to automatically scroll a RadListBox when dragging an item over the top or bottom of the ListBox?

8 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 22 Aug 2012, 02:36 PM
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.

0
Erik
Top achievements
Rank 1
answered on 24 Aug 2012, 05:16 PM
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; }
    }
}

0
Accepted
George
Telerik team
answered on 27 Aug 2012, 08:51 AM
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.

0
Erik
Top achievements
Rank 1
answered on 28 Aug 2012, 04:19 PM
Thanks autoscroll works with that build :)
0
Shaun
Top achievements
Rank 1
answered on 11 May 2016, 12:50 PM

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

0
Yana
Telerik team
answered on 16 May 2016, 10:15 AM
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.
0
Shaun
Top achievements
Rank 1
answered on 16 May 2016, 10:43 AM

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

0
Yana
Telerik team
answered on 17 May 2016, 12:54 PM
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.
Tags
ListBox
Asked by
Erik
Top achievements
Rank 1
Answers by
George
Telerik team
Erik
Top achievements
Rank 1
Shaun
Top achievements
Rank 1
Yana
Telerik team
Share this question
or