views:

95

answers:

2

Hi,

I have a user control that has 2 controls A and B within it. Now, A and B have their own logic in their DragDrop event.

The parent that has these 2 controls has to handle the DragDrop from these events in its own way. So I have in the parent something like, parent.A.DragDropEvent += new EventHandler () etc...

Now, I want to handle the DragDrop event of both controls in the parent and NOT let the children handle it themselves. On the other hand, if these controls are used stand- alone(not within the parent control), then I want their own logic to work or take over.

How do I achieve this? thanks!

+2  A: 

Add a boolean property like HandleDragDrop to your child controls and let them only handle drag-and-drop if that property is true. Make it true by default. Set it to false in your parent control.

Fyodor Soikin
A: 

If you wan't the child controls to be just displayed but not interactive in the implementation where they have the parent you could set IsHitTestVisible="false" on them in the xaml where they have the parent and then all interactions would go to the parent.

Jimmy Hoffa