When hooking the Tapped event on a page (so I can get all events that are not caught by children), I am also getting the event fired when a user taps a button on the page.
I would have expected the button to "swallow" the tap, but that does not seem to be the case.
The workaround is simple, if annoying - hook the Tap event on each button present and set Handled to true. I get how to do the workaround.
My question is whether or not I am understanding this correctly. If hooking the Tap event on all my buttons that are on the page (so I don't get the tap event on the page fired) really the correct way to do this.
Thanks.
You should handle the
Click
event on the button, not theTapped
event. If theTapped
event still bubbles to the page - yes, by all means, handle it on the button and mark itHandled
to prevent bubbling or try to change theIsTapEnabled
value on the button. If handling the event is the only way and you don't like the code behind - you can either have all buttonTapped
events use the same handler or define an attached behavior that does the swallowing in a separate class where you define the behavior.