WPF 4 多点触控拖放
我有一个 WPF 4 应用程序,我使用标准 DragDrop.DoDragDrop
方法实现了拖放,但我使用触摸而不是鼠标事件来实现拖放。
我的网格(我正在拖动)的 XAML 如下:
<Grid x:Name="LayoutRoot"
ManipulationStarting="ManipulationStarting"
ManipulationDelta="ManipulationDelta"
ManipulationCompleted="ManipulationCompleted"
IsManipulationEnabled="True">
<!-- children in here -->
</Grid>
现在背后的代码如下所示:
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 似乎认为我的两根手指正在尝试缩放(如捏合手势)...
有谁知道解决这个问题的方法?
多谢 标记
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.
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>
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
}
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?
Thanks a lot
Mark
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于多点触控,您需要使用 Surface Toolkit for Windows Touch。它包括适合多点触控场景的拖放框架。它包括一个拖放框架。该链接包含几个操作场景。
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.
尽管这只是一个有根据的猜测,但我想说
DragDrop.DoDragDrop()
无法并行处理多个拖动手势。索引:
DoDragDrop()
的实现是静态的DoDragDrop()< 的调用/code> 一直阻塞,直到放置发生或被取消
但是,如果有人能在这件事上纠正我,我会很高兴,因为我目前也在寻找适合触摸支持的 DND API。
问候,
七
Although this is just an educated guess, I would say that
DragDrop.DoDragDrop()
is not capable to handle multiple drag guestures in parallel.Indices:
DoDragDrop()
is staticDoDragDrop()
is blocking until the drop occured or was canceledHowever, I would be glad if someone could correct me in this matter, because I'm currently also searching an DND API suitable for touch support.
Regards,
Seven