问题描述
我有一个 UWP 应用程序,我试图在其中启用 UI 元素上的操作事件.我订阅了 ManipulationStarted 事件,但意识到它没有触发.然后,根据一些建议,我尝试在 Grid 上设置 IsManipulationEnabled 属性,但开始收到编译错误,提示找不到 IsManipulationEnabled 属性.我错过了什么吗?
I have a UWP application where I am trying to enable manipulation events on the UI elements. I subscribed to the ManipulationStarted event but realized that it was not firing. Then, based on some suggestions, I tried setting IsManipulationEnabled property on the Grid but started getting compilation error saying that IsManipulationEnabled property could not be found. Am I missing out on something?
推荐答案
IsManipulationEnabled
是 WPF 属性.为了在 UWP 中获取操作事件,您必须设置 ManipulationMode
属性.
IsManipulationEnabled
is a WPF property. In order to get manipulation events in UWP, you'll have to set the ManipulationMode
property.
来自的备注部分ManipulationMode
页面:
您必须将 ManipulationMode 设置为 System 或 None 以外的值如果要处理 ManipulationStarted 等操作事件来自应用代码中的 UI 元素.
例如
ManipulationMode = ManipulationModes.Scale
| ManipulationModes.TranslateX
| ManipulationModes.TranslateY
| ManipulationModes.TranslateInertia;
这篇关于UWP 中没有 IsManipulationEnabled 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!