This is the structure of my application:
- Main Window has two ContentControls
- Each ContentControl has a UserControl
- Each UserControl has a ListBox
So graphically speaking, the user is presented with a Window with two ListBoxes: one with products and the other a shopping cart.
I want to enable drag-and-drop functionality among these two ListBoxes; i.e products can be dragged into the shopping cart.
I have seen examples of drag-and-drop between ListBoxes on the same window. But is it possible to drag and drop between UserControls?
I have looked at an example; is there a simpler way?
I came across a simple drag drop solution in Expression Blend; I tried searching for it, but in vain.
Drag-and-drop using behaviors is very simple. Download this complete implementation and sample and try it out:
- ItemsControl Drag Drop Behavior for WPF
It is not clear what is a problem if you've already seen how to do drag-n-drop between listboxes on the same window. Use this code or tell us what's wrong with it.
The good thing about drag-n-drop functionality is that control which starts DND operation doesn't have to know anything regarding control which accepts DND result.