I've seen A LOT of counterintuitive answers for this, i really wanna clear the confusion for everybody.
I actively searched for this question so i can write the answer for it.
It's simple.
-------------------------------------------------------------------------------------------------------
An example would be helpful, so let's say i have a Grid
(ancestor) that contains a Button
(descendant).
Each of them can have Preview and no-Preview event for the SAME action (the no-Preview is called bubbling or something but it sounds very stupid to me so i won't call it bubbling).
Let's say the event is MouseRightButtonDown
.
Both Grid
and Button
can catch the MouseRightButtonDown
event and do something when they catch it with a method in code-behind (obviously),
they both can also catch the PreviewMouseRightButtonDown
event, now we have 4 methods.
Obviously when you do a mouse down at the Button
, you'll also hit the Grid
, so which method will run first?
The order is Preview -> no-Preview
.
In Preview, the order is Ancestor -> Descendant.
In No-preview, the order is Descendant-> Ancestor.
When you set e.Handled = true
in any of the 4 methods, it'll prevent the next methods to run (except if you do something with the HandledEventsToo
, but i don't know anything about this yet).