hi, I'm trying to get you into the picture firstly, I'm trying to implement a gesture in WPF4 VS2010, it is like you move your finger until it crosses a TouchPoint that you already passed by with the SAME finger , so my thought is to make a list and check for every new TouchPoint if it exists , if yes then you have done your gesture , if not then add the TouchPoint to the collection to be compared with the following TouchPoints. for some reason this doesn't work well so I moved to another approach , replacing TouchPoints with X , Y for the TouchPoint and convert them into Strings and try to use Contains method against them , using TouchMove and TouchUp events my code looks like :
private void g1_TouchMove(object sender, TouchEventArgs e)
{
if(touchX.Contains(""+e.GetTouchPoint(g1).Position.X) && touchY.Contains(""+e.GetTouchPoint(g1).Position.Y))
{
// Clearing the lists , changing the canvas background color to know that the gesture is done
touchX.Clear();
touchY.Clear();
g1.Background = Brushes.AliceBlue;
}
else
{
//adding new X, Y values to their respective lists
touchX.Add(""+e.GetTouchPoint(g1).Position.X);
touchY.Add( ""+e.GetTouchPoint(g1).Position.Y);
}
}
private void g1_TouchUp(object sender, TouchEventArgs e)
{
//clearing the lists after the touch is up (finger removed)
touchX.Clear();
touchY.Clear();
//getting the canvas it's original background color
g1.Background = Brushes.Orange;
}
So , when testing it it doesn't work , even if I move my touch in a straight line it changes the background. any Ideas ?
Thanks in advance