Yoni C
07.16.2012
1 Solution
Hi Yoni,
Thank you for your patience. We have an example that demonstrates how to implement the drag-and-drop functionality for ListBoxEdit - How to do drag and drop items from one ListBoxEdit to another. Please take a moment to review it. This example does not show how to implement multiple drag-and-drop, but you can realize it by using a similar method as shown in the Drag & drop "mutiple list items" from one ListBoxEdit control to another ListBoxEdit control & Drag & Drop list items within a ListBoxEdit control to rearrange the items thread.
Please review these tickets and feel free to reactivate this thread if the demonstrated approach does not meet your requirements.
Updated:
As for ListBoxEditItem objects, you can find them in the following manner:
1. Get a WrapPanel object by using the LayoutHelper class:
2. Look over ListBoxEditItem objects inside the WrapPanel object. Add the item's content to the ListBoxEdit.SelectedItems collection if the item intersects the dragRectangle object:[C#]WrapPanel panel = LayoutHelper.FindElement(DropTarget, n => n.GetType() == typeof(WrapPanel)) as WrapPanel; if(panel==null) return;
var en = panel.Children.GetEnumerator();
while(en.MoveNext()) {
ListBoxEditItem item = en.Current as ListBoxEditItem;
if(item == null)
return;
<!--check item-->
Rect listBoxRect = new Rect(item.TranslatePoint(new Point(), this.DragTarget), item.RenderSize);
if (dragRectangle.IntersectsWith(listBoxRect))
DropTarget.SelectedItems.Add( item.DataContext);
}
If you have additional questions, feel free to reactivate this thread.
Thanks
Show all comments
-
Hi Ivan,
I don't really know how to reactivate this thread, so I'll just comment on your solution. The solution you provided is not exactly what I needed. But it gives my some info for my next step.
I've created a dragselection control which acts similar to what microsoft does in the windows explorer when you hold the mouse down and select items.
I had this thing working for a system.windows.control.listbox because I could loop through all the listboxitems and find there current postion on the screen. However now with the devexpress listboxedit, I do not now how to iterate through the listboxedititems and to find there screen positions. Can you give me a way to do this. -
Hello Yoni,
Thank you for your response and providing the additional information. Please give us some time to examine your requirements in detail.
-
Hi Yoni,
I have updated my answer to demonstrate how this can be done. Please take a moment to review it.
-
Your code worked well, however there is one thing that doesn't quite work. The selection is set because I can see there are items in the selecteditems however the selection doesn't get highlighted in the listboxEdit. Normally Clicking the listboxedit with selectionmode set to extended will highlight the items perfectly so, I must be missing something. Are you sure setting the selecteditems alone is enough?
-
Ok never mind my last comment. I just upgraded to 12.1.5 and and the highlight now occurs as expected.
Thank you very much for your support! -
Hi Yoni,
I am glad to see that your problem was solved. You are welcome!
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.