SharpAffair
SharpAffair

Reputation: 5478

.NET - UserControl Drag & Drop - Child Controls

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?

Upvotes: 3

Views: 1766

Answers (1)

steckl
steckl

Reputation: 414

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.

Upvotes: 2

Related Questions