开发者

WPF Drag-and-Drop between ListBoxes in different UserControls

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 windo开发者_JAVA百科w. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜