启用父操作时 WPF TouchUp 不触发 [英] WPF TouchUp not firing when parent manipulation is enabled

查看:26
本文介绍了启用父操作时 WPF TouchUp 不触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Canvas,带有一个子控件.子控件可以正常接收所有 PreviewTouchDown 和 PreviewTouchUp 事件 - 但是在 Canvas 上启用 Manipulation (IsManipulationEnabled = true) 后,只有down"事件在子对象上被触发,但 TouchUp 和 PreviewTouchUp 事件不会根本不会开火..

I have a Canvas, with one child control. The child controls receives all PreviewTouchDown and PreviewTouchUp events fine - but after enabling Manipulation (IsManipulationEnabled = true) on the Canvas, only the "down" events get fired on child object, but the TouchUp and PreviewTouchUp events doesn't fire at all..

知道这里发生了什么吗?

Any ideas what's going on here?

推荐答案

您也需要将子元素的 IsManipulationEnabled 设置为 true.

You need to set IsManipulationEnabled to true on the child element, too.

触摸和操作事件之间的关系在输入概述/触摸中进行了解释和操纵触摸和操纵事件之间的关系部分:

The relationship between touch and manipulation events is explained in Input Overview / Touch and Manipulation, section The Relationship Between Touch and Manipulation Events:

UIElement 始终可以接收触摸事件.当...的时候IsManipulationEnabled 属性设置为 true,一个 UIElement 可以接收触摸和操作事件.如果 TouchDown 事件不是处理(即 Handled 属性为 false),操作逻辑捕获对元素的触摸并生成操作事件.如果在 TouchDown 事件中将 Handled 属性设置为 true,操作逻辑不生成操作事件.这下图显示了触摸事件和操纵事件.

A UIElement can always receive touch events. When the IsManipulationEnabled property is set to true, a UIElement can receive both touch and manipulation events. If the TouchDown event is not handled (that is, the Handled property is false), the manipulation logic captures the touch to the element and generates the manipulation events. If the Handled property is set to true in the TouchDown event, the manipulation logic does not generate manipulation events. The following illustration shows the relationship between touch events and manipulation events.

触摸和操作事件

这篇关于启用父操作时 WPF TouchUp 不触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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