3

I have FlowLayoutPanel and UserControl's on it with drag & drop reordering. This sort of works. But the problem is that child controls prevent dragging of the actual parent UserControl.

So my question is how to enable dragging of a UserControl that contains child controls?

SharpAffair
  • 5,558
  • 13
  • 78
  • 158
  • In what way do they prevent dragging of the parent control? Filling the whole space? Or locking the parent itself into place? – Mike Guthrie Mar 19 '12 at 18:36
  • Try to click on a surface of the parent. I think you can drag the parent, but you can't drag it if you click on a child user control inside it. – lex87 Mar 23 '12 at 12:36

1 Answers1

2

If I understand you right I had the same problem as you and I solved it by propagating events of the child element to it's parent.

If you have a draggable UserControl containing a label. You have to call the events of the UserControl when the events of the label occurs. E.g. in the Label's OnMouseDown() call the UserControl's OnMouseDown() and just pass the Event-Args. I didn't find a better way than handling each event that is required for drag and drop separately.

steckl
  • 404
  • 8
  • 16