wsick / Fayde

Inspired by Silverlight; XAML engine using Javascript and rendering to the HTML5 Canvas.
MIT License
189 stars 27 forks source link

event bubble issue #127

Closed Sally-Xu closed 9 years ago

Sally-Xu commented 9 years ago

Looks like setting e.Handled = true doesn't prevent event from bubbling up. Test case: When click a menu item in ContextMenu, both OnMouseLeftButtonDown and _HandleOverlayMouseButtonDown are fired, even the e.Handled = true was set in OnMouseLeftButtonDown event handler and was fired first.

BSick7 commented 9 years ago

https://msdn.microsoft.com/en-us/library/ms742806(v=vs.110).aspx#concept_handled

Handled does not prevent bubbling. It's only used to notify others that an event was handled.

Sally-Xu commented 9 years ago

I believe setting e.Handled = true stops the even bubbling in Silverlight (after version 2, it was a different story earlier than version 2).

http://silverlight4tutorials.blogspot.com/2010/05/silverlight-events.html

Maybe it is different in WPF?

Either way is fine, as long we have a consistent pattern so we can code the event handler accordingly, such as always check if e.Handled == true.