本文介绍了WPF 4多点触控拖放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在那里我已经实现拖放使用标准 DragDrop.DoDragDrop 办法WPF 4应用程序,但是我做它用,而不是鼠标事件联系。

I have a WPF 4 application where I have implemented Drag and Drop using the standard DragDrop.DoDragDrop approach, but Im doing it using touch instead of Mouse events.

我的XAML我的网格(即林拖动)如下:

My XAML for my Grid (that Im dragging) is as follows:

<Grid x:Name="LayoutRoot"
      ManipulationStarting="ManipulationStarting"
      ManipulationDelta="ManipulationDelta"
      ManipulationCompleted="ManipulationCompleted"
      IsManipulationEnabled="True">
    <!-- children in here -->
</Grid>

现在的code的背后是这样的:

Now the code behind is like this:

    private void ManipulationStarting(object sender, ManipulationStartingEventArgs e)
    {
        e.ManipulationContainer = this;
        e.Handled = true;
    }

    private void ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
    {
        e.Handled = true;
        DragDrop.DoDragDrop(this, new DataObject(GetType(), this), DragDropEffects.Move);
    }

    private void ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
    {
        //completed stuff
    }

当我试图拖动用一个手指时,如果已经用另一个手指拖动(不同的手例如,它可以模拟两个人)的第二个触摸似乎并不正确注册,事实上,看来,Windows认为我的两个手指正在努力扩展(如捏的手势)......

BUT when I try to drag with one finger while already dragging with another finger (different hands for example, which would simulate two people) the second touches don't seem to register properly, infact, it seems that windows thinks that my two fingers are trying to scale (like a pinch gesture)...

有谁知道一个方法来解决这个问题?

Does anyone know a way to get around this?

非常感谢马克

推荐答案

有关多点触控,你将要使用的曲面工具包的Windows触控。它包括适用于多点触控方案一拖和拖放框架。它包括一个拖和下降的框架。这种联系包括几个如何做的情景。

For multi-touch, you're going to want to use the Surface Toolkit for Windows Touch. It includes a drag-and-drop framework suitable for multi-touch scenarios. It includes a drag-and-drop framework. That link includes several how-to scenarios.

这篇关于WPF 4多点触控拖放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-19 00:29