¿Cómo detecto toques simultáneos en elementos de la interfaz de usuario en Windows Phone 7?

I'm new to WP7 and I'm sure I'm missing something obvious. In the code below I create a bunch of rectangle and then toggle thier color when touched. The trouble is that when I touch two rectangles at the same time only one gets an event. I assume this is because I'm using the mouse event but I don't see a touch event to hook up to. Any pointers in the right direction would be greatly appreciated.

Relevant XAML

     <Grid x:Name="LayoutRoot" Background="Transparent">
        <toolkit:WrapPanel  x:Name="RectWrapPanel" Height="768" Width="480"/>

Código detrás:

namespace colortouch
    public partial class MainPage : PhoneApplicationPage
        SolidColorBrush blueBrush = new SolidColorBrush() { Color = Colors.Blue };
        SolidColorBrush redBrush = new SolidColorBrush() { Color = Colors.Red };
        SolidColorBrush blackBrush = new SolidColorBrush() { Color = Colors.Black };

        // Constructor
        public MainPage()

            for (int i = 0; i < 126; i++)
                Rectangle rect = new Rectangle();
                rect.Height = 50;
                rect.Width = 50;

                rect.Stroke = blackBrush;
                rect.Fill = blueBrush;

                //rect.MouseLeftButtonDown += new MouseButtonEventHandler(rect_MouseLeftButtonDown);
                rect.MouseEnter += new MouseEventHandler(rect_MouseEnter);
                Button b = new Button();


        void rect_MouseEnter(object sender, MouseEventArgs e)
            Rectangle rect = sender as Rectangle;

            if (rect.Fill == blueBrush)
                rect.Fill = redBrush;
                rect.Fill = blueBrush;

preguntado el 08 de enero de 11 a las 16:01

2 Respuestas

Siga nuestro Manipulation events.

Respondido el 08 de enero de 11 a las 21:01

You can also consider Touch Panel and Gestures for your requirements.

Working with Touch Input (Windows Phone)

WP7 Tip of the Day: Silverlight Toolkit: Gestures

Respondido el 09 de enero de 11 a las 02:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.