Surface2014.04.09 16:55

 private readonly Stopwatch _DoubleTapStopwatch = new Stopwatch();

 private Point _LastTapLocation;



  private bool IsDoubleTap(TouchEventArgs e)

        {

            Point currentTapPosition = e.GetTouchPoint(this).Position;

            bool tapsAreCloseInDistance = currentTapPosition.GetDistanceTo(_LastTapLocation) < 15;

            _LastTapLocation = currentTapPosition;


            TimeSpan elapsed = _DoubleTapStopwatch.Elapsed;

            _DoubleTapStopwatch.Restart();

            bool tapsAreCloseInTime = (elapsed != TimeSpan.Zero && elapsed < TimeSpan.FromSeconds(0.4));


            return tapsAreCloseInDistance && tapsAreCloseInTime;

        }


 private void DragAndDropScatterViewItem_PreviewTouchDown(object sender, TouchEventArgs e)

        {

            if (IsDoubleTap(e))

            {

//더블탭시 구현될 코드         

            }

        }



자세한 설명은 생략..

Posted by 동동(이재동)