WPF 4触摸事件获得捏手势的中心

我正在使用.net 4 beta 2触摸库,我试图在我的WPF应用程序中实现缩放function。

我可以让缩放工作正常,但我想要的是放大捏手势的中心,我在API中看不到有关如何实现这一点的任何内容。

是否有一些方法或属性可以揭示在捏合手势中使用的2个联系人,以便我可以获得它们的中心?

编辑:

我刚刚调查使用TouchEventArgsGetIntermediateTouchPoints方法,它似乎没有给我我想要的东西。

非常感谢马克

假设您正在使用新的TouchXxxxEvent路由事件,它们都采用具有TouchDevice属性的TouchEventArgs 。 如果调用其GetTouchPoint()方法,则可以获得代表触摸点的TouchPoint

Jaime Rodriguez的更多细节和示例代码 。

事实certificate,我所追求的属性一直在我面前。

Manipulation2DDeltaEventArgs类具有OriginXOriginX属性,这些属性特定于捏手势的中心点,所以我只是使用它,它的一切都很好:)

这个答案适用于.Net 4发布版本。

在使用ManipulationDelta事件的情况下, ManipulationDeltaEventArgs.ManipulationOrigin包含捏合手势的中心点。 坐标相对于ManipulationDeltaEventArgs.ManipulationContainer ,可以在ManipulationStarting事件的处理程序中设置。

示例代码:

 private void object_ManipulationDelta(object sender, ManipulationDeltaEventArgs e) { ... // If this was a multitouch gesture // (like pinch/zoom - indicated by e.DeltaManipulation.Scale) // the following line will get us point between fingers. Point position = e.ManipulationOrigin; ... }