This question is locked. New answers and comments are not allowed.
I read this
http://www.telerik.com/community/forums/winforms/ui-controls/drag-drop.aspx
in 2007 it was not supported, does radlistbox support it now in 2009?
Or is there some workaround code avaible for that function.
http://www.telerik.com/community/forums/winforms/ui-controls/drag-drop.aspx
in 2007 it was not supported, does radlistbox support it now in 2009?
Or is there some workaround code avaible for that function.
3 Answers, 1 is accepted
0
Hi Markus,
Thank you for the questions.
Please follow the steps:
1. Create two RadListBox controls.
2. Add some RadListBoxItem instances to the controls.
3. Set the AllowDrop property to true for the both of the listboxes.
4. Subscribe to MouseDown, DragOver and DragDrop events.
5. Please see the sample code below for the event handlers:
I hope this helps. Please contact me again if I can help you with something else.
Sincerely yours,
Boyko Markov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Thank you for the questions.
Please follow the steps:
1. Create two RadListBox controls.
2. Add some RadListBoxItem instances to the controls.
3. Set the AllowDrop property to true for the both of the listboxes.
4. Subscribe to MouseDown, DragOver and DragDrop events.
5. Please see the sample code below for the event handlers:
private void radListBox_DragDrop(object sender, DragEventArgs e) |
{ |
RadListBox listBox = sender as RadListBox; |
RadListBoxItem item = (RadListBoxItem)e.Data.GetData(typeof(RadListBoxItem)); |
RadListBox sourceListBox = item.ElementTree.Control as RadListBox; |
sourceListBox.Items.Remove(item); |
listBox.Items.Add(item); |
} |
private void radListBox_MouseDown(object sender, MouseEventArgs e) |
{ |
RadListBox listBox = sender as RadListBox; |
if (listBox.SelectedIndex >= 0) |
{ |
listBox.DoDragDrop(listBox.Items[listBox.SelectedIndex], DragDropEffects.Copy); |
} |
} |
private void radListBox_DragOver(object sender, DragEventArgs e) |
{ |
e.Effect = DragDropEffects.Copy; |
} |
I hope this helps. Please contact me again if I can help you with something else.
Sincerely yours,
Boyko Markov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Joshua Gates
Top achievements
Rank 1
answered on 24 Feb 2009, 04:10 PM
i have implented the code suggested...
however when i do..it does not select the item i want...
it always selects the first item..
basically the item selected does not highlight...
but if i comment out the code in the mousedown event...it highlights the item correctly but does not drag the item
however when i do..it does not select the item i want...
it always selects the first item..
basically the item selected does not highlight...
but if i comment out the code in the mousedown event...it highlights the item correctly but does not drag the item
0
Hi Joshua Gates,
Thank you for writing. I have prepared a complete sample project demonstrating how to implement drag and drop between two RadListBoxes. Please, find it as an attachment to this message.
Hope this helps, write me back if you still have more questions.
Best wishes,
Martin Vasilev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thank you for writing. I have prepared a complete sample project demonstrating how to implement drag and drop between two RadListBoxes. Please, find it as an attachment to this message.
Hope this helps, write me back if you still have more questions.
Best wishes,
Martin Vasilev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.