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

ListBox, RichTextBox and TreeView - drag and drop problem

2 Answers 170 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Dmitry
Top achievements
Rank 1
Dmitry asked on 29 Jun 2014, 03:34 PM
Hello!

I have a view with a RadListBox consisting of RadRichTextBoxes on the left, and RadTreeView on the right.
Previously I just needed DragDrop behavior to enable user reorder items inside ListBox view, but now I am implementing scenario when user can drag an item from TreeView into one of the RadRichTextBoxes (this will insert some text at the caret position, but that does not matter).
I made this scenario work, but discovered that attempt to reorder items in ListBox now does not work correctly - if a dragged list item is dropped on a visual line before or after some other text item - it just disappears from the view. During investigation I discovered that all is ok unless I subscribe to any RadRichTextBox DropPreview event (to process tree item drop into RichTextBox). After this subscription is made DrapDrop behavior method Drop is never called, thus dragged list item is removed from ListBox ItemsSource collection and never added back to it with new index.

Thus my question is - how can I fix this problem and get both DragDrop scenarios work correctly?

2 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 01 Jul 2014, 12:41 PM
Hi Dmitry,

The issue in this particular scenario is probably caused by the mentioned PreviewDrop event handler of the RichTextBox. If you have handled the event (by setting the e.Handled = true) the DragDropCompleted event of the ListBox won't be fired and the item won't be added again while reordering. Please try to set the e.Handled to false and let me know if this helps. If it doesn't I'll ask you to share a sample project so we can investigate the scenario on our side.

I'm looking forward to hearing from you.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Kalin
Telerik team
answered on 02 Jul 2014, 09:16 AM
Hi Dmitry,

I'm sorry in my previous post I meant that the Drop event of the ListBox won't be fired not the DragDropCompleted event.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
DragAndDrop
Asked by
Dmitry
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or