我有一个 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 似乎认为我的两根手指是试图缩放(像捏手势)......
有谁知道解决这个问题的方法?
非常感谢马克