tags:

views:

60

answers:

1

Hi

I am having a problem in using the DragEventHandler. The scenario is that: A parent element which has its own DragEventHandlers (in this case Grid) contains child element (Panel) which also has its own DragEventHandlers.

So when an item is dragged over the child element, the event handlers of the parent elt is used instead of the child. I 've child to use child.PreviewDragEnter.. instead of DragEnter but it does not work.

Strange enough, for MouseEvent like mouseEnter or mouseLeave handlers of both Parent and child work.

Can anyone help me with that. How can the drageventhandler of the Child elt be used instead.

Thank you very much.

A: 

Can't say too much without more details of the language and library you are using.. But one common trick I've seen is to make sure you instantiate the bindings of the child elements BEFORE the parent elements if you want them to be separate from the parent...

Harley Green
HI, Thanks for your response. I am using C#.For the child element, I extend the Panel class and use this.DragEnter, this.DragLeave... to assign an event handler to it. XAML will be: <Grid> <ExtendedPanel> ... </ExtendedPanel></Grid>. The compiler will initiate the Parent first. How do I instantiate the bindings of the child before the element?
Khue