I develop a WPF4 touch aplication which use some Microsoft Surface controls. I would like to catch the MouseDoubleClick event on a ScatterViewItem. The event fires when i use the mouse, but when i use my finger, the event is never raised. Why ?
Thanks a lot.
UPDATE :
I finally wrote this code to reproduce a simple double tap with TouchLeave event on a limited rect (16px width & height) and 500ms for the required time between 2 TouchLeave events. This code is not optimized but it works, if you have some remark, don't hesitate :)
private bool _doubleHasTimeAndPos = false;
private TimeSpan? _doubleTouchTime = null;
private Point? _doubleTouchPoint = null;
private void ScatterViewItem_TouchLeave(object sender, TouchEventArgs e)
{
if (!this._doubleHasTimeAndPos)
{
this._doubleTouchTime = DateTime.Now.TimeOfDay;
this._doubleTouchPoint = e.GetTouchPoint(this.scatterView).Position;
this._doubleHasTimeAndPos = true;
}
else
{
if (DateTime.Now.TimeOfDay.Subtract(this._doubleTouchTime.Value).TotalMilliseconds <= 500)
{
Point touchPoint = e.GetTouchPoint(this.scatterView).Position;
double xDelta = Math.Abs(this._doubleTouchPoint.Value.X - touchPoint.X);
double yDelta = Math.Abs(this._doubleTouchPoint.Value.Y - touchPoint.Y);
if (xDelta <= 16 && yDelta <= 16)
{
// DOUBLE TAP here !
}
}
this._doubleTouchTime = null;
this._doubleTouchPoint = null;
this._doubleHasTimeAndPos = false;
}
}