允许指针事件从按钮点击冒泡 [英] Allow Pointer events to bubble from Button clicks

查看:36
本文介绍了允许指针事件从按钮点击冒泡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当单击容器内的按钮时,我需要采取哪些步骤来启用 PointerPressed 和 PointerMoved 等指针事件以在容器元素上触发?

What steps to I need to take to enable Pointer events such as PointerPressed and PointerMoved to fire on a Container element when Buttons inside the container are clicked?

推荐答案

我最终采用的方法是向容器添加事件处理程序,并将 boolhandledEventsToo 参数设置为 true.

The approach I ended up taking was to add event handlers to the container, and set the bool handledEventsToo parameter to true.

mainPage.AddHandler(PointerPressedEvent, new PointerEventHandler(pointerPressedHandler), true);
mainPage.AddHandler(PointerMovedEvent, new PointerEventHandler(pointerMovedHandler), true);

这意味着容器仍然有机会处理事件,即使它们已经被处理.

This means the container still gets a chance to process the events even if they have already been handled.

这篇关于允许指针事件从按钮点击冒泡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆