Hopefully a simple question as I'm just getting to grips with routed events.
I have a custom UserControl
. This contains lots of other controls.
Further up my tree I want to respond to double click events originating from one of the contained controls (not my UserControl
). However, my UserControl
is obviously catching the event and setting the source
property to itself. How can I stop it doing this?
I cannot use OriginalSource
since this points to the lowest level control clicked (Border
or whatever).
eg.
MyWindow <--- Want to handle double click here with Source = MyContainedControl1
|
+-MyUserControl (this is setting Source to itself. How do I turn this off?)
|
+-MyContainedControl1
|
Border <---- Mouse double clicks here
EditBox
Etc
I have tried overriding OnMouseDoubleClick()
and OnPreviewMouseDoubleClick()
in MyUserControl
, but at this point the events already have the Source set to MyUserControl
even before calling base or anything.
Many thanks