Drag and drop from RadListControl to RadListView

6 posts, 0 answers
  1. Richard
    Richard avatar
    6 posts
    Member since:
    Nov 2016

    Posted 22 Nov 2016 Link to this post

    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.

  2. Dess
    Admin
    Dess avatar
    2100 posts

    Posted 22 Nov 2016 Link to this post

    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.
  3. Richard
    Richard avatar
    6 posts
    Member since:
    Nov 2016

    Posted 23 Nov 2016 in reply to Dess Link to this post

    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? 

  4. Dess
    Admin
    Dess avatar
    2100 posts

    Posted 23 Nov 2016 Link to this post

    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 sample approach for implementing RadItemDragDropManager which shows a drop 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.
  5. Richard
    Richard avatar
    6 posts
    Member since:
    Nov 2016

    Posted 05 Dec 2016 Link to this post

    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

  6. Dess
    Admin
    Dess avatar
    2100 posts

    Posted 06 Dec 2016 Link to this post

    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.
Back to Top