標準的なアプローチを使用してドラッグアンドドロップを実装したWPF4アプリケーションがありますがDragDrop.DoDragDrop
、マウスイベントの代わりにタッチを使用して実装しています。
グリッド用のXAML(Imドラッグ)は次のとおりです。
<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
}
しかし、すでに別の指でドラッグしているときに1本の指でドラッグしようとすると(たとえば、2人の人をシミュレートする別の手)、2番目のタッチが正しく登録されていないようです。実際、Windowsは私の2本の指がスケーリングしようとしています(ピンチジェスチャのように)...
誰かがこれを回避する方法を知っていますか?
どうもありがとうマーク