キャンバス内の長方形を変換するのに少し問題があります。私がやりたいことは、ユーザーの指の位置に応じて長方形を移動することです。ここに私のXAMLがあります:
<Canvas Margin="100" Height="100" Width="300">
<Rectangle Fill="Orange" Width="100" x:Name="rect" Height="100" >
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragDelta="GestureListener_DragDelta"/>
</toolkit:GestureService.GestureListener>
</Rectangle>
</Canvas>
コードビハインドで行ったことは次のとおりです。
private void GestureListener_DragDelta(object sender, DragDeltaGestureEventArgs e)
{
if ((double)e.HorizontalChange != 0)
Canvas.SetLeft(rect, e.HorizontalChange - 100);
}
アプリケーションを実行すると、四角形を左右に動かすと振動するという非常に面白い動作をします。それで、誰がエラーがどこにあるか知っていますか?ありがとうございました。