Event bubbling problem


I am testing touch capabilities of my chipworx module (v1.2 , last firmwares).

I have created a SimpleTouchScreenImage class derived from Image.

 public class SimpleTouchScreenImage:Image
        public string NameId { get; set; }
        public SimpleTouchScreenImage(Bitmap oneBitmap, string targetName)
            this.Bitmap= oneBitmap;
            NameId = targetName;


Next I add 2 instances to my canvas with Touch Down event :

            // SECTION CODE 1
            // debug OK : if touch then event is fire
            SimpleTouchScreenImage btImg = new SimpleTouchScreenImage(
            btImg.TouchDown += new TouchEventHandler(menu1_TouchDown);
            Canvas.SetLeft(btImg, 250);
            Canvas.SetTop(btImg, 100);
            SimpleTouchScreenImage btImg2 = new SimpleTouchScreenImage(
            btImg2.TouchDown += new TouchEventHandler(menu1_TouchDown);
            Canvas.SetLeft(btImg2, 300);
            Canvas.SetTop(btImg2, 100);

And my touch handler (not finish- just for debug purpose) is :

void menu1_TouchDown(object sender, TouchEventArgs e)
            int x;
            int y;
        //    StackPanel st = sender as StackPanel; //who send  touch down event message
            SimpleTouchScreenImage touchImg = (e.OriginalSource) as SimpleTouchScreenImage;

            if (touchImg != null)
                switch (touchImg.NameId)
                    case "flecheBleuBas":   _text.TextContent = "DOWN ----captured at (";
                    case "flecheBleuHaut": _text.TextContent = "UP ----captured at (";
                    case "flecheBleuGauche": _text.TextContent = "LEFT ----captured at (";
                    case "flecheBleuDroite": _text.TextContent = "RIGHT ----captured at (";
            e.GetPosition((UIElement)sender, 0, out x, out y); // retrieve coord
            _text.TextContent +=x.ToString() + "," + y.ToString() + ")"; // add coord

            _text.ForeColor = ColorUtility.ColorFromRGB(255, 0, 0);

Emulator and test on chipworx are OK…

Now i would like to do the same with Stackpanel container:

            //KO NO TOUCH fire event!!!
            //new container stackpanel type SimpleTouchScreenImage
            StackPanel menu1 = new StackPanel();
            ArrayList imgMenuArray = new ArrayList();
            imgMenuArray.Add(new SimpleTouchScreenImage  (
                            "flecheBleuBas"         )
            imgMenuArray.Add(new SimpleTouchScreenImage(
            foreach (SimpleTouchScreenImage img in imgMenuArray)
                menu1.Children.Add(img); // add all in stackpanel
            menu1.Orientation = Orientation.Vertical;
            menu1.TouchDown+=new TouchEventHandler(menu1_TouchDown);
            Canvas.SetLeft(menu1, 25);
            Canvas.SetTop(menu1, 25);
            mainCanvas.Children.Add(menu1);  // attach StackPanel to canvas with specified position

Emulator test is OK but test on ChipWorks fails: touch event is never fired.

Is there something wrong with the code?

Thanks for your help.

(I don’t find file atachment to joint my source file)


I am not an expert at WPF so i will let others answer this but have you seen glide? http://tinyclr.com/forum/12/3283/
with ongoing discussion http://tinyclr.com/forum/12/3627/

thanks for information.

I resolved the problem. When I use a pen (stylus) everything works perfectly .It is not the case with my finger!