Search code examples
c#silverlightwindows-phonemulti-touch

Windows Phone multi-touch


I would like to create in my Windows Phone Silverlight application two controls and start my timer when both of them are pressed. I tried to do this with MouseLeftButtonDown event, but it does not support multitouch. Tap event is fired after control is released so it is not what I want. Hold event is fired after one second after control is pressed - I would like to get event immediately when both controls are pressed in the same time.

How can I achieve that?


Solution

  • Thank you @Fabian . I used TouchPoint

    I did something like this and it works:

    TouchPoint primaryTouchPoint = e.GetPrimaryTouchPoint(mainGrid);
    TouchPointCollection touchPoints = e.GetTouchPoints(mainGrid);
    
    foreach (TouchPoint tp in touchPoints)
    {
        var controlPosition = myControl.TransformToVisual(Application.Current.RootVisual).Transform(new Point(0, 0));
        if (tp.Action == TouchAction.Down && tp_is_in_myControl)
            do_something;
    
    }