11 Answers, 1 is accepted
Could you share the XAML for your RadListBox and the RadGridView? If you are only intending on enabling the reorder you may need to write an event handler for the DragLeave or the Drop event. I prefer the Drop event, because this will let me use the DragCues to let the user know where the item is droppable.
In the event handler do a check to see if the target is the RadListBox. If it is not, then cancel the drag operation. That will effectively return the ListBox item to where it was before the Drag operation.
You can find the documentation for the Events of the DragDropManager here. And also the DragDropManager's documentation for RadListBox behavior here.
I tried doing DragDropManager.AddDropHandler(rlbColumns, New DragEventHandler(AddressOf OnElementDrop)) but it never fired. I'm not sure what I'm doing wrong trying to capture this event.
I would suggest using the RadListBox control instead of the ListBox control. Using the drag&drop behaviors, you could inherit the ListBoxDragDropBehavior and override the Drop method instead of handling the Drop event. The behavior uses the drag&drop events and exposes virtual methods and it eases the implementation. Please, refer to our online demos here for more information about how to use drag and drop with RadListBox control - http://demos.telerik.com/silverlight/#ListBox/DragDrop
According to the second question - this feature is still in a progress and we are working on it. Most probably we will release it with the upcoming Q2 SP1 release.
the Telerik team
I need a suggestion to this issue:
i designed a drag & drop listbox to listbox. I used drag & drop function from telerik sample. Its working fine.
But in some cases, I see dragstatus = InProgress & dropstatus is in pending (or) Impossible. Which works fine in certain circumstances.
looking for the Resolution,
In continuation with above asked question, I would like to know if scroll while dragging is supported now. I have number of items in listbox. I want to scroll item from top of my listbox to last of the list. There is a scroll on the listbox. It lets me drag only upto visible items in the listbox. If I want to drag beyond that, automatic scroll should have worked. But it is not working. I also tried same on your demo site at http://demos.telerik.com/silverlight/#ListBox/DragDrop. But here also this is not working.
Can you tell me how to make this work?
We managed to reproduce the issue and it seems that there is a bug in the RadListBox control that causes the auto scrolling feature to not work when dragging an item for reordering purposes. We logged the issue in our Public Issue Tracker System where you can track its status.
I updated your Telerik points for bringing this to our attention. We apologize for any inconvenience that this maybe causing.
I'm still struggling with Scott's original problem: RadListBox with working drag/drop intended ONLY for reordering. Reorder works OK. But if I drag an item from the RadListBox to another control, it disappears from the listbox. Have tried several combinations of event handling (including DragLeave and Drop as suggested above), but have not been able to prevent item from disappearing.
Goal is to prevent drop onto any control except the original RadListBox -- providing for ONLY a reorder of the RadListBox.
DragLeave doesn't seem to permit cancelling the drag operation overall, and Drop (since it relates to Target) would require implementation for every possible target on the page.
Can you please describe specifically how to achieve JUST reorder for the RadListBox?
In order to prevent dropping on outside of the ListBox you would need to implement a custom ListBoxDragDropBehavior and override the CanDrop method as shown below:
Also in order to avoid items removal from the RadListBox we should override the DragDropCompleted method in the custom ListBoxDragDropBehavior:
Hopefully this helps.
That works nicely! Thanks for the guidance.