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

Drag and drop from RadListControl to RadListView

5 Answers 166 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 22 Nov 2016, 09:45 AM

Hi,

I'm writing a form where user can rearrange items on ListView and add new from ListControl.

I've used Drag and drop feature, because it's very easy and convenient for client. For ListView I've used ListViewDragDropService (http://docs.telerik.com/devtools/winforms/listview/drag-and-drop/drag-and-drop-in-bound-mode) and to add new items from ListControl OLE (http://docs.telerik.com/devtools/winforms/listview/drag-and-drop/combining-raddragdropservice-and-ole-drag-and-drop).

 

Problem is when user rearrange items you have this nice indicator (insertion lines) where item will be put. But when I drag item from ListControl there is no information where item will be putted. Even I use ShouldDropAfter to figure-out if I should put item before or after.

This is not consistent so how can I "activate" this line?

I will be grateful to show me solution, direction how to achieve this. 

 

I use 2016.3.913.40 version.

5 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 22 Nov 2016, 12:57 PM
Hello Richard,

Thank you for writing.  

The drop indicator is a functionality coming from the ListViewDragDropService. However, the Ole drag and drop is a standard MS approach for handling drag and drop operation and it has nothing to do with our ListViewDragDropService. In order to customize the standard MS drag and drop indication, you can refer to general programming forums like MSDN and StackOverflow. A sample approach is demonstrated in the following thread:  https://blogs.msdn.microsoft.com/adamroot/2008/02/19/shell-style-drag-and-drop-in-net-wpf-and-winforms/

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Telerik UI for WinForms is ready for Visual Studio 2017 RC! Learn more.
0
Richard
Top achievements
Rank 1
answered on 23 Nov 2016, 10:15 AM

Hi Dess,

Thanks for quick replay.

I'm person who don't accept "it's impossible" for an answer :)  (because dealing with pure drag-n-drop is not very "nice" way to do it)

I saw that ListControl also have RadDragDropService (ListControlDragDropService) but it's hidden from accessing it. So I just create new instance of simple RadDragDropService and by subscribing PreviewDragOver and PreviewDragDrop I've achieved the same functionality.

So now I'm using only RadDragDropService for Drag-n-drop operation.

But still I don't have this 'drop indicator' :( How to get it done? Should I create new class deriving from RadDragDropService  and put something there? Or some other tricky way? 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 23 Nov 2016, 03:05 PM
Hello Richard, 

Thank you for writing back. 

RadListControl doesn't support RadDragDropService. I would recommend you to have a look at our Demo application >> DropDown & List >> ListControl >> Drag & Drop example. It demonstrates a approach for implementing RadItemDragDropManager which shows a hint indicator. It is directly applicable for two RadListControls. Feel free to use a similar approach for handling drag and drop from RadListControl to RadListView.

I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
Telerik by Progress
Telerik UI for WinForms is ready for Visual Studio 2017 RC! Learn more.
0
Richard
Top achievements
Rank 1
answered on 05 Dec 2016, 10:51 AM

Hi Dess,

The example looks more complicated that it should. So I ended up with my first thought:

I've created new class, inherit from RadDragDropService. And use the same approach from ListView (use RadLayeredWindow to draw DragHint in correct position).

 

Thanks for help

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 06 Dec 2016, 08:58 AM
Hello Richard, 

Thank you for writing back. 

Feel free to use this approach which suits your requirement best. As an alternative solution, I can suggest you using a RadListView instead of a RadListContol. Thus, you can benefit from the RadDragDropService and easily achieve drag and drop functionality between two RadListView controls.

I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
Telerik by Progress
Telerik UI for WinForms is ready for Visual Studio 2017 RC! Learn more.
Tags
ListView
Asked by
Richard
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Richard
Top achievements
Rank 1
Share this question
or